ActionScript Tips


Author: David Zimmer
Date: 06.18.11 - 7:00am



I have never really had to code in ActionScript before but its obviously has quite a developed API.

This entry will house various code tidbits and resources as I stumbled across them.
  • Misc ActionScript Helper Class Features:
    • Text Logging - (trace window for any player w/scroll support)
    • Save ByteArray to File
    • Load ByteArray from File
    • Hexdump ByteArray
    • Msgbox Shellcode
    • HeapSpray
    • CreateButton w/text label
    • Download File

  • ActionScript Hexdump function
  • Shellcode2Exe now supports writeInt,writeUnsignedInt, and endian ActionScript commands

  • FlashDevelop
    • is a nice UI for ActionScript code development.
    • You can use it with the free flex sdk so you dont need Flash.
    • To use classes like the FileSystem stuff, you can use an AIR project.
    • fl.* and mx.* classes (such as UIScrollBar) are not included in the free flex sdk, however you can use them if you make your own swc file and include it in your project using a trial version of flash. (drag and drop the classes you want to the library window from the components window and click generate swc in the publish options)
    • Sample using helper.as and a swc library in FlashDevelop


  • Working with hex numbers:
    var n:Number;
    trace(parseInt("7FFFFFFF", 16));
    n = 2147483647;
    trace(n.toString(16));
    
  • To dump a byte array to disk: (must call from a user event for browser)
    import flash.net.*;
    import flash.system.*;
    import flash.utils.*;
    var code:ByteArray = new ByteArray();
    code.endian = Endian.BIG_ENDIAN;
    code.writeUnsignedInt(1094795585);
    ...
    var fR:FileReference=new FileReference();
    fR.save(code,"xxx.bin");
    
  • To log text to the main display at runtime: (no debug player needed, see helper class for scrolling support)
    package  {
    
        import flash.display.*;
        import flash.system.*;
        import flash.text.*;
    
        public class Main extends MovieClip {
    		
    	private var myTextBox:TextField = new TextField(); 
    		
    	function xx(x){
    		myTextBox.text += x + "\n";
    	}
    		
    	public function Main() {
    		myTextBox.autoSize = TextFieldAutoSize.LEFT;
                    var format:TextFormat = new TextFormat();
                    format.font = "Verdana";
                    format.size = 15;
                    myTextBox.defaultTextFormat = format;
    		addChild(myTextBox); 
    		xx("Starting flash version: " + Capabilities.version.toLowerCase() );
    	}
        }
    }
    





Comments: (3)

On 06.18.11 - 6:51pm Dave wrote:
this looks interesting too..flash remote debugging protocol info

On 06.20.11 - 7:47am Dave wrote:
I have to say, the amount of code it requires to create a simple button with text, or to create a textbox that scrolls is pretty nutty. Having to scatter your logic across async event handlers is a bit infuriating too.

On 06.29.11 - 1:38pm Dave wrote:
couple interesting links

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 17 + 11 = ? followed by the letter: V 



About Me
More Blogs
Main Site
Posts: (year)
2023 (4)
     Yara Workbench Automation
     VS linker versions
     IDA decompiler comments
     DispCallFunc
2022 (5)
     VB6 Implements
     VB6 Stubs BS
     VB6 TypeInfo
     VB6 VTable Layout
     Yara isPCode rule
2021 (2)
     rtcTypeName
     VB6 Gosub
2020 (5)
     AutoIT versions
     IDA JScript 2
     Using VB6 Obj files from C
     Yara Corrupt Imports
     Yara Undefined values
2019 (6)
     Yara WorkBench
     SafeArrayGetVartype
     vb6 API and call backs
     PrintFile
     ImpAdCallNonVirt
     UConnect Disable Cell Modem
2017 (5)
     IDA python over IPC
     dns wildcard blocking
     64bit IDA Plugins
     anterior lines
     misc news/updates
2016 (4)
     KANAL Mod
     Decoders again
     CDO.Message Breakpoints
     SysAnalyzer Updates
2015 (5)
     SysAnalyzer and Site Updates
     crazy decoder
     ida js w/dbg
     flash patching #2
     JS Graphing
2014 (5)
     Delphi IDA Plugin
     scdbg IDA integration
     API Hash Database
     Winmerge plugin
     IDACompare Updates
2013 (9)
     Guest Post @ hexblog
     TCP Stream Reassembly
     SysAnalyzer Updates
     Apilogger Video
     Shellcode2Exe trainer
     scdbg updates
     IDA Javascript w/IDE
     Rop Analysis II
     scdbg vrs ROP
2012 (13)
     flash patching
     x64 Hooks
     micro hook
     jmp api+5 *2
     SysAnalyzer Updates
     InjDll runtime config
     C# Asm/Dsm Library
     Shellcode Hook Detection
     Updates II
     findDll
     Java Hacking
     Windows 8
     Win7 x64
2011 (19)
     Graphing ideas
     .Net Hacking
     Old iDefense Releases
     BootLoaders
     hll shellcode
     ActionScript Tips
     -patch fu
     scdbg ordinal lookup
     scdbg -api mode
     Peb Module Lists
     scdbg vrs Process Injection
     GetProcAddress Scanner
     scdbg fopen mode
     scdbg findsc mode
     scdbg MemMonitor
     demo shellcodes
     scdbg download
     api hashs redux
     Api hash gen
2010 (11)
     Retro XSS Chat Codes
     Exe as DLL
     Olly Plugins
     Debugging Explorer
     Attach to hidden process
     JS Refactoring
     Asm and Shellcode in CSharp
     Fancy Return Address
     PDF Stream Dumper
     Malcode Call API by Hash
     WinDbg Cheat Sheet
2009 (1)
     GPG Automation