Last active
May 6, 2016 22:29
-
-
Save zwetan/ee7832dbf6dfe5e93ca067b3efca2c74 to your computer and use it in GitHub Desktop.
download and extract Phrack uuencoded stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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( "<" ).join( "<" ); | |
flat = flat.split( ">" ).join( ">" ); | |
flat = flat.split( """ ).join( "\"" ); | |
flat = flat.split( "&" ).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