logga


1 physics tetris

I think most variants of the classic tetris game has been built already for about 10 years ago. But I thought I could give it a try and build one with a physics engine.

you control the blocks with the mouse, I assume you know the rules. There are some differences with the deletion of rows and there are some bugs with row checking, its made with collision detection of points in columns and rows which means it can be tricked. I also had some problems with destruction of objects. An effect of that is some memory leakage.

some source

One Comment to “physics tetris”

New player version and page

With the new version of the ampache player I made an own page to the project, Here, to keep things on one place.

The most important changes for this version is support for large catalogs > 100k songs and a filter feature. AMF have a limitation for how big a message can be and to avoid to large messages the request is splited into requests with 1000 songs. For large collections that becomes a lot of requests and apache might complain but they are then stored on the client in a local shared object and the update only have to me made when the catalog is updated.

No Comments to “New player version and page”

8 Flex ampache player

[update2: I made a new page for the player, here, go there instead ]

I installed ampache awhile ago to be able to listen to my music from different locations. But I didn’t like the html front to browse the music and started to build one in flex 2 and amfphp instead. It fetches all the songs from the database first. 2000 songs becomes about 500kb in an amf collection which is almost nothing compare to one mp3. There are some really nifty things built into flex as dragdrop, column sorting, search with keyboard and so on.

[update: I made some changes during the week. The are no visual changes but a lot behind.
- Rewrote the code to use the Cairngorm framwork.
- enabled login
- catalog cache on clientside. The database is now stored as a local shared object and is not downloaded again unless requested. Later the update procedure could be automatic and only download the differences from the cache.
- some double click features. double click to add to playlist and play.
- a settings view. Its not really enabled that much but its there. ]

The sound spectrum visualization is a separate swf-file and is very easy to change to something nicer. Right now it’s a copy-paste of the adobe example.

You can see the result here, the username is here prewritten. It’s still very beta but it got the basics. browsing and listening to music. The music in the example are fetched from hype machine and lies public on the net. If you send me a mail I can delete them.

player.png

There are some things that need to be fixed to make it better:

- better integration with ampache. I disabled the login procedure and wrote some new files to be able to access the music and covers without login. The plan is to use the flexplayer without changes in the ampache code. [update: The login is enabled now and everything should be safe ]

- there are some security issues. [update: see above ]

- rewrite code to the Cairngorm framework. The code is about to grow. [update: done! the code is a lot bigger now in rows but simpler to follow]

- Include more of the ampache features. There is a lot missing in this version.

- Dragdrop of folders to the playlist doesn’t work perfect. When you drag something from the tree structure a request to the server is made to get the information about the tracks. If the result is not received before the drop, the playlist is not populated.

- better player, the buttons are not updated correct all the times.

- nicer stylesheet. need to sit down with the Flex2StyleExplorer.

- installation could be simpler, and an installation and compilation guide could be written

source:
ampache_player_02.rar
ampache_player_03.rar

[update2: newer verision here ]

if you never used flex before it can be a little tricky to get started. But if you not planing to change the code then you don’t have to compile. You can change the stylesheet without compiling. It can be built with “free” (not opensource) tools, the flex SDK, but flex builder 2 makes it a little bit easier.

There is also a thread in the ampache forum about the player. http://ampache.org/forums/viewtopic.php?pid=9273

8 Comments to “Flex ampache player”

155 computeSpectrum exploit

You are listening to:

A lot of music and videos on Internet is delivered through a flashplayer as myspace, youtube, lastfm, deezer, ampache etc. That is not a coincidence since its a good way to deliver music and video. With as3 a new function SoundMixer.computeSpectrum() was put in the toolbox. Its the only function I can think of that add a functionality that could not be archived with as2 and some serverside tricks.

If you are listen to Internet music and at the same time surf around to watch fancy spectrum visualisations the debug dialog will popup once in a while. The debugger explains that you are violating the sandbox and writes out which files the cross domain violation concerns.

Some posts on Internet explains that you could use try catch to avoid the debug dialog, that’s not working but you could use it to catch the error. I wrote a little code which can be used to track the sound the user is listening to. The code is only useful for the debugger player since it writes a human-readable error message together with the short errorID.


try
{
SoundMixer.computeSpectrum(new ByteArray());
}
catch(e:SecurityError)
{
var message:String = e.message;
var startStr:String = "cannot access ";
var start:int = message.indexOf(startStr)+startStr.length;
var end:int = message.indexOf(". A policy file is");
var sounduri:String = message.substring(start, end);
tf.text = sounduri;
}

The uri can be used to identify the source of the sound if you want to download it, A process possible but boring with http-proxies as fiddler or livehttpheaders. If you have the uri you can get the sound but in most cases its not possible due to other security measurements as cookies, the referheader, and/or one-time only uris. In some more cases its not legal.

The exploit can also be used to track behavior on internet which is big business . There is nothing preventing me from posting what you are listening to or watch at youtube right now to my big brother database.

The exploit is only tested successfully on the debugger player for firefox for winxp (fp 9.0.47) and linux (fp 9.0.48), and its only working sometimes.

155 Comments to “computeSpectrum exploit”

4 displacement window

This is a demo of a way to use the displacementmap-filter to distort a movieclip in a controlled way. In most cases the displacementmap-filter is used together with some kind of random functions to create flag or liquid wave distortions. It also a experiment on how to use a physics engine as a tween engine.

You can drag the physics point but if you do to fast motions the physics grid can be messed up.
press “p” to show the physics points. Wait until new random points are set.
press “d” to show a preview of the displacementbitmap

Every 150th frame new destination points are calculated. The physics points are then moved to the new location and anchors are attached in the corners. Then the physics points are dragged to the old location and released. The result is a motion tween made of physics springs.

The circles are controlled by the physics engine and the distance to the original positions are calculated. The points are then the input for creation of a two quadratic bezier-surfaces, one for x-axis and on for the y-axis. I found the surface page on wikipedia after I made the application, which was good since its a little bit over my head, but the curvepage is good and have nice ani-gifs. A bitmapdata is created from the surfaces and used as the displacement filter. If simpler linear instead of quadratic bezier curves are used a perspective effect can be archived in a simple way.

The original clip is masked away, otherwise it shows up behind the filter during heavy displacement.

The performance is not that great. Its not that strange since its a lot of calculations. The displacement bitmapdata has the dimensions of the bounding box of the physics points. If the box is 200×200 px the displacement calculations and setpixel() in every frame is made 2×200x200 = 80000 times.

I made some small attempts to rescale the window before the calculation to be able to make a smaller displacement filter but I didnt succed.

An alternative way to archive the same effect could be to use the same triangle distortion trick as 3d engines uses. But if you want the same degree of smothness you will need a lot of triangles. Another advantage over the triangletrick is that the mouseevents on the clip still works like clicks and rollovers. That can be archived with the MovieClipMaterial in papervision3D but that’s a little bit trickier.

I’m a little bit confused why transparency and dropshadow filter on a filter works. Its a good thing here but a little bit unexpected.

The source needs some refactoring and documentation maybe. The drawings and calculations have to be separated from the physics part to make it useful. If you can use it and make something cool let me know.

4 Comments to “displacement window”

1 Image Obfuscator

Soon the face recognition tools will expand into the search market. And since everyone putting everything on the Internet and nothing disappears, integrity problems will increase.

A solution to that could be something like this application. It transforms a image to something that is harder to read. and then when you want to look at it it transforms back to the original. Of course you can make a printscreen and crop out the image but that is quite boring.

There are a lot of other uses of a application like this. Photgraphers afraid of people stealing there photos and so on, you don’t need the waterstamp.

This is not a usable product right now but more like a proof of concept.


original


encrypted


decrypted

There are some problems to fix before the application can be used more serious:
1. use of jpeg. An obfuscated image can not be compressed destructive, as jpeg, and still work,
2. keep the compression rate. The example changes every pixel depending on there value and the distorted image cant be compresses since there are no large areas of the same color.
3. add a real encryption algorithm. for example TEA. That would make it almost impossible for an computer do transform back with brutal-force since the result is not plaintext.

Most of them are easy to archive if you instead of images use swf. But one of the main purpose of the application is to be able to continue to use the same channels for images that exist today. People don’t understand the swf format. The example above can be cropped and in some cases rescaled and still be able to be decrypted.

source

One Comment to “Image Obfuscator”