Skip to content

Instantly share code, notes, and snippets.

@zwetan
Last active May 6, 2016 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zwetan/ee7832dbf6dfe5e93ca067b3efca2c74 to your computer and use it in GitHub Desktop.
Save zwetan/ee7832dbf6dfe5e93ca067b3efca2c74 to your computer and use it in GitHub Desktop.
download and extract Phrack uuencoded stuff
#!/usr/bin/as3shebang
import shell.*;
var name:String = "13.html";
if( FileSystem.exists( name ) )
{
FileSystem.remove( name );
}
var online:String = "http://phrack.org/issues/69/" + name;
Program.exec( "wget " + online );
var page:String = FileSystem.read( name );
var mark_start:String = "begin 644 ";
var makr_end:String = "end";
var data:Array = [];
var filename:String = "";
var lines:Array = page.split( "\n" );
var line:String;
var copy:Boolean = false;
for( var i:uint = 0; i < lines.length; i++ )
{
line = lines[i];
if( line.substr( 0, mark_start.length ) == mark_start )
{
filename = line.substr( mark_start.length );
copy = true;
}
if( line.substr( 0, makr_end.length ) == makr_end )
{
copy = false;
}
if( copy )
{
data.push( line );
}
}
var flat:String = data.join( "\n" );
flat = flat.split( "&lt;" ).join( "<" );
flat = flat.split( "&gt;" ).join( ">" );
flat = flat.split( "&quot;" ).join( "\"" );
flat = flat.split( "&amp;" ).join( "&" );
FileSystem.write( filename + ".uue" , flat );
Program.exec( "uudecode -o " + filename + " < " + filename + ".uue " );
Program.exec( "tar zxvf " + filename );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment