diff --git a/.DS_Store b/.DS_Store index 0e15780..de69815 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/frameworkgui/attach2Agents.pl b/frameworkgui/attach2Agents.pl index 19316be..5ee9d38 100755 --- a/frameworkgui/attach2Agents.pl +++ b/frameworkgui/attach2Agents.pl @@ -1,129 +1,129 @@ -#!/usr/bin/perl -use DBI; -use Cwd; - -# Read the standard input (sent by the form): -read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); -# Get the name and value for each form input: -@pairs = split(/&/, $FormData); -# Then for each name/value pair.... -foreach $pair (@pairs) { - # Separate the name and value: - ($name, $value) = split(/=/, $pair); - # Convert + signs to spaces: - $value =~ tr/+/ /; - # Convert hex pairs (%HH) to ASCII characters: - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - # Store values in a hash called %FORM: - $FORM{$name} = $value; -} - - -$number = $FORM{"agentPhNo"}; -$controlnumber = $FORM{"controlPhNo"}; -$path = $FORM{"agentURLPath"}; -$key = $FORM{"agentControlKey"}; -$platform = $FORM{"platformDD1"}; - - - -##----- put your code here - $dir = getcwd; -$configfile = $dir . "/config"; -open(CONFIG, "+<$configfile"); -while () -{ - chomp; - s/#.*//; - s/^\s+//; - s/\s+$//; - ($var, $value) = split(/\s*=\s*/, $_, 2); - $Variables{$var} = ${value}; -} -$Variables{"OS"} = $^O; - $webserver = $Variables{"WEBSERVER"}; - $fullpath = $webserver. $path; - $command1 = "mkdir " . $fullpath; - system($command1); - $controlfile = $fullpath . "/control"; - $command2 = "touch " . $controlfile; - system($command2); - $command3 = "chmod 777 " . $controlfile; - system($command3); - $picturefile = $fullpath . "/picture.jpg"; - $command4 = "touch " . $picturefile; - system($command4); - $command5 = "chmod 777 " . $picturefile; - system($command5); - $textfile = $fullpath . "/text.txt"; - $command6 = "touch " . $textfile; - system($command6); - $command7 = "chmod 777 " . $textfile; - system($command7); - $pictureupload = $fullpath . "/pictureupload.php"; - $command8 = "touch " . $pictureupload; - system($command8); - $command9 = "chmod 777 " . $pictureupload; - system($command9); - $pictureuploadtext = ""; - open(PICFILE, ">$pictureupload"); - print PICFILE $pictureuploadtext; - close(PICFILE); - $textupload = $fullpath . "/textuploader.php"; - $command10 = "touch " . $textupload; - system($command10); - $command11 = "chmod 777 " . $textupload; - system($command11); - $textuploadtext = ""; - open(TEXTFILE, ">$textupload"); - print TEXTFILE $textuploadtext; - close(TEXTFILE); - $controlupload = $fullpath . "/controluploader.php"; - $command12 = "touch " . $controlupload; - system($command12); - $command13 = "chmod 777 " . $controlupload; - system($command13); - $controluploadtext = ""; - open(CONTROLFILE, ">$controlupload"); - print CONTROLFILE $controluploadtext; - close(CONTROLFILE); - $putfile = $fullpath . "/putfunc"; - $command14 = "touch " . $putfile; - system($command14); - $command15 = "chmod 777 " . $putfile; - system($command15); - $table = "agents"; - $table2 = "data"; - $sqlserver = $Variables{"MYSQLSERVER"}; - $username = $Variables{"MYSQLUSER"}; - $password = $Variables{"MYSQLPASS"}; - $port = $Variables{"MYSQLPORT"}; - $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); - $number2 = "\"" . $number . "\""; - $path2 = "\"" . $path . "\""; - $key2 = "\"" . $key . "\""; - $controlnumber2 = "\"" . $controlnumber . "\""; - $platform2 = "\"" . $platform . "\""; - $insertquery = "INSERT INTO $table (id,number,path,controlkey,controlnumber,platform) VALUES (DEFAULT,$number2,$path2,$key2,$controlnumber2,$platform2)"; - $insertquery2 = "INSERT INTO $table2 (id,sms,contacts,picture,root) VALUES (DEFAULT, NULL, NULL, NULL, NULL)"; - $sql = $dbh->prepare($insertquery); - $sql->execute; - $sql2 = $dbh->prepare($insertquery2); - $sql2->execute; - $query2 = "SELECT id from agents where number=" . $number; - $sql = $dbh->prepare($query2); - $idblah = $sql->execute; - @rows = $sql->fetchrow_array(); - $id = @rows[0]; - $startcommand = "perl agentpoll.pl " . $path . " " . $key . " " . $id; - $pid = fork; - die "fork failed" unless defined $pid; - if ($pid ==0) - { - system($startcommand); - } - -##----- end of your code - -my $url = "menu.pl"; -print "Location: $url\n\n"; +#!/usr/bin/perl +use DBI; +use Cwd; + +# Read the standard input (sent by the form): +read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); +# Get the name and value for each form input: +@pairs = split(/&/, $FormData); +# Then for each name/value pair.... +foreach $pair (@pairs) { + # Separate the name and value: + ($name, $value) = split(/=/, $pair); + # Convert + signs to spaces: + $value =~ tr/+/ /; + # Convert hex pairs (%HH) to ASCII characters: + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + # Store values in a hash called %FORM: + $FORM{$name} = $value; +} + + +$number = $FORM{"agentPhNo"}; +$controlnumber = $FORM{"controlPhNo"}; +$path = $FORM{"agentURLPath"}; +$key = $FORM{"agentControlKey"}; +$platform = $FORM{"platformDD1"}; + + + +##----- put your code here + $dir = getcwd; +$configfile = $dir . "/config"; +open(CONFIG, "+<$configfile"); +while () +{ + chomp; + s/#.*//; + s/^\s+//; + s/\s+$//; + ($var, $value) = split(/\s*=\s*/, $_, 2); + $Variables{$var} = ${value}; +} +$Variables{"OS"} = $^O; + $webserver = $Variables{"WEBSERVER"}; + $fullpath = $webserver. $path; + $command1 = "mkdir " . $fullpath; + system($command1); + $controlfile = $fullpath . "/control"; + $command2 = "touch " . $controlfile; + system($command2); + $command3 = "chmod 777 " . $controlfile; + system($command3); + $picturefile = $fullpath . "/picture.jpg"; + $command4 = "touch " . $picturefile; + system($command4); + $command5 = "chmod 777 " . $picturefile; + system($command5); + $textfile = $fullpath . "/text.txt"; + $command6 = "touch " . $textfile; + system($command6); + $command7 = "chmod 777 " . $textfile; + system($command7); + $pictureupload = $fullpath . "/pictureupload.php"; + $command8 = "touch " . $pictureupload; + system($command8); + $command9 = "chmod 777 " . $pictureupload; + system($command9); + $pictureuploadtext = ""; + open(PICFILE, ">$pictureupload"); + print PICFILE $pictureuploadtext; + close(PICFILE); + $textupload = $fullpath . "/textuploader.php"; + $command10 = "touch " . $textupload; + system($command10); + $command11 = "chmod 777 " . $textupload; + system($command11); + $textuploadtext = ""; + open(TEXTFILE, ">$textupload"); + print TEXTFILE $textuploadtext; + close(TEXTFILE); + $controlupload = $fullpath . "/controluploader.php"; + $command12 = "touch " . $controlupload; + system($command12); + $command13 = "chmod 777 " . $controlupload; + system($command13); + $controluploadtext = ""; + open(CONTROLFILE, ">$controlupload"); + print CONTROLFILE $controluploadtext; + close(CONTROLFILE); + $putfile = $fullpath . "/putfunc"; + $command14 = "touch " . $putfile; + system($command14); + $command15 = "chmod 777 " . $putfile; + system($command15); + $table = "agents"; + $table2 = "data"; + $sqlserver = $Variables{"MYSQLSERVER"}; + $username = $Variables{"MYSQLUSER"}; + $password = $Variables{"MYSQLPASS"}; + $port = $Variables{"MYSQLPORT"}; + $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); + $number2 = "\"" . $number . "\""; + $path2 = "\"" . $path . "\""; + $key2 = "\"" . $key . "\""; + $controlnumber2 = "\"" . $controlnumber . "\""; + $platform2 = "\"" . $platform . "\""; + $insertquery = "INSERT INTO $table (id,number,path,controlkey,controlnumber,platform) VALUES (DEFAULT,$number2,$path2,$key2,$controlnumber2,$platform2)"; + $insertquery2 = "INSERT INTO $table2 (id,sms,contacts,picture,root) VALUES (DEFAULT, NULL, NULL, NULL, NULL)"; + $sql = $dbh->prepare($insertquery); + $sql->execute; + $sql2 = $dbh->prepare($insertquery2); + $sql2->execute; + $query2 = "SELECT id from agents where number=" . $number; + $sql = $dbh->prepare($query2); + $idblah = $sql->execute; + @rows = $sql->fetchrow_array(); + $id = @rows[0]; + $startcommand = "perl agentpoll.pl " . $path . " " . $key . " " . $id; + $pid = fork; + die "fork failed" unless defined $pid; + if ($pid ==0) + { + system($startcommand); + } + +##----- end of your code + +my $url = "menu.pl"; +print "Location: $url\n\n"; diff --git a/frameworkgui/attachMobileModem.pl b/frameworkgui/attachMobileModem.pl index ca8d145..4e84367 100755 --- a/frameworkgui/attachMobileModem.pl +++ b/frameworkgui/attachMobileModem.pl @@ -1,180 +1,180 @@ -#!/usr/bin/perl -use Cwd; -use DBI; -# Read the standard input (sent by the form): -read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); -# Get the name and value for each form input: -@pairs = split(/&/, $FormData); -# Then for each name/value pair.... -foreach $pair (@pairs) { - # Separate the name and value: - ($name, $value) = split(/=/, $pair); - # Convert + signs to spaces: - $value =~ tr/+/ /; - # Convert hex pairs (%HH) to ASCII characters: - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - # Store values in a hash called %FORM: - $FORM{$name} = $value; -} - - -$number = $FORM{"modemPhoneNo"}; -$key = $FORM{"controlKey"}; -$path = $FORM{"appURLPath"}; - - -##----- put your code here -$dir = getcwd; -$configfile = $dir . "/config"; -open(CONFIG, "+<$configfile"); -while () -{ - chomp; - s/#.*//; - s/^\s+//; - s/\s+$//; - ($var, $value) = split(/\s*=\s*/, $_, 2); - $Variables{$var} = ${value}; -} -$Variables{"OS"} = $^O; -#print "Content-type: text/html\r\n\r\n"; -#print "Connect Smartphone App"; - $webserver = $Variables{WEBSERVER}; - $fullpath = $webserver. $path; - $type = "app"; - $number2 = "\"" . $number . "\""; - $path2 = "\"" . $path . "\""; - $key2 = "\"" . $key . "\""; - $type2 = "\"" . $type . "\""; - $command1 = "mkdir " . $fullpath; - system($command1); - $connectfile = $fullpath . "/connect"; - $command2 = "touch " . $connectfile; - system($command2); - $command3 = "chmod 777 " . $connectfile; - system($command3); - $picturefile = $fullpath . "/picture.jpg"; - $command4 = "touch " . $picturefile; - system($command4); - $command5 = "chmod 777 " . $picturefile; - system($command5); - $textfile = $fullpath . "/text.txt"; - $command6 = "touch " . $textfile; - system($command6); - $command7 = "chmod 777 " . $textfile; - system($command7); - $textfile2 = $fullpath . "/text2.txt"; - $command77 = "touch ". $textfile2; - system($command77); - $command7777 = "chmod 777 " . $textfile2; - system($command7777); - $pictureupload = $fullpath . "/pictureupload.php"; - $command8 = "touch " . $pictureupload; - system($command8); - $command9 = "chmod 777 " . $pictureupload; - system($command9); - $pictureuploadtext = ""; - open(PICFILE, ">$pictureupload"); - print PICFILE $pictureuploadtext; - close(PICFILE); - $textupload = $fullpath . "/textuploader.php"; - $command10 = "touch " . $textupload; - system($command10); - $command11 = "chmod 777 " . $textupload; - system($command11); - $textuploadtext = ""; - open(TEXTFILE, ">$textupload"); - print TEXTFILE $textuploadtext; - close(TEXTFILE); - $text2upload = $fullpath . "/text2uploader.php"; - $command100 = "touch " . $text2upload; - system($command100); - $command110 = "chmod 777 " . $text2upload; - system($command110); - $text2uploadtext = ""; - open(TEXT2FILE, ">$text2upload"); - print TEXT2FILE $text2uploadtext; - close(TEXT2FILE); - $connectupload = $fullpath . "/connectuploader.php"; - $command12 = "touch " . $connectupload; - system($command12); - $command13 = "chmod 777 " . $connectupload; - system($command13); - $connectuploadtext = ""; - open(CONNECTFILE, ">$connectupload"); - print CONNECTFILE $connectuploadtext; - close(CONNECTFILE); - $getfuncfile = $fullpath . "/getfunc"; - $command6 = "touch " . $getfuncfile; - system($command6); - $command7 = "chmod 777 " . $getfuncfile; - system($command7); - $putfuncfile = $fullpath . "/putfunc"; - $command6 = "touch " . $putfuncfile; - system($command6); - $command7 = "chmod 777 " . $putfuncfile; - system($command7); - $getfuncupload = $fullpath . "/getfuncuploader.php"; - $command10 = "touch " . $getfuncupload; - system($command10); - $command11 = "chmod 777 " . $getfuncupload; - system($command11); - $getfuncuploadtext = ""; - open(GETFUNCUPLOADFILE, ">$getfuncupload"); - print GETFUNCUPLOADFILE $getfuncuploadtext; - close(GETFUNCUPLOADFILE); - $putfuncupload = $fullpath . "/putfuncuploader.php"; - $command10 = "touch " . $putfuncupload; - system($command10); - $command11 = "chmod 777 " . $putfuncupload; - system($command11); - $putfuncuploadtext = ""; - open(PUTFUNCUPLOADFILE, ">$putfuncupload"); - print PUTFUNCUPLOADFILE $putfuncuploadtext; - close(PUTFUNCUPLOADFILE); - while(1){ - $fullpath1 = $webserver. $path . "/connect"; - open(CONNECTFILE, "+<$fullpath1"); - $line= ; - $correctstring = $key . " CONNECT"; - if ($line eq $correctstring) - { - $command = "\n" . $key . " CONNECTED"; - print CONNECTFILE $command; - close(CONNECTFILE); - # print "CONNECTED!\n"; - last; - } - else { - close(CONNECTFILE); - # sleep(1); - } - } - $table = "modems"; - $sqlserver = $Variables{"MYSQLSERVER"}; - $username = $Variables{"MYSQLUSER"}; - $password = $Variables{"MYSQLPASS"}; - $port = $Variables{"MYSQLPORT"}; - $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); - $type = "app"; - $number2 = "\"" . $number . "\""; - $path2 = "\"" . $path . "\""; - $key2 = "\"" . $key . "\""; - $type2 = "\"" . $type . "\""; - $insertquery = "INSERT INTO $table (id,number,path,controlkey,type) VALUES (DEFAULT,$number2,$path2,$key2, $type2)"; - $sql = $dbh->prepare($insertquery); - $sql->execute; - $startcommand = "perl poller.pl " . $path . " " . $key; - $pid = fork; - die "fork failed" unless defined $pid; - if ($pid ==0) - { - system($startcommand); - } - - - -##----- end of your code - -my $url = "menu.pl"; -print "Location: $url\n\n"; +#!/usr/bin/perl +use Cwd; +use DBI; +# Read the standard input (sent by the form): +read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); +# Get the name and value for each form input: +@pairs = split(/&/, $FormData); +# Then for each name/value pair.... +foreach $pair (@pairs) { + # Separate the name and value: + ($name, $value) = split(/=/, $pair); + # Convert + signs to spaces: + $value =~ tr/+/ /; + # Convert hex pairs (%HH) to ASCII characters: + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + # Store values in a hash called %FORM: + $FORM{$name} = $value; +} + + +$number = $FORM{"modemPhoneNo"}; +$key = $FORM{"controlKey"}; +$path = $FORM{"appURLPath"}; + + +##----- put your code here +$dir = getcwd; +$configfile = $dir . "/config"; +open(CONFIG, "+<$configfile"); +while () +{ + chomp; + s/#.*//; + s/^\s+//; + s/\s+$//; + ($var, $value) = split(/\s*=\s*/, $_, 2); + $Variables{$var} = ${value}; +} +$Variables{"OS"} = $^O; +#print "Content-type: text/html\r\n\r\n"; +#print "Connect Smartphone App"; + $webserver = $Variables{WEBSERVER}; + $fullpath = $webserver. $path; + $type = "app"; + $number2 = "\"" . $number . "\""; + $path2 = "\"" . $path . "\""; + $key2 = "\"" . $key . "\""; + $type2 = "\"" . $type . "\""; + $command1 = "mkdir " . $fullpath; + system($command1); + $connectfile = $fullpath . "/connect"; + $command2 = "touch " . $connectfile; + system($command2); + $command3 = "chmod 777 " . $connectfile; + system($command3); + $picturefile = $fullpath . "/picture.jpg"; + $command4 = "touch " . $picturefile; + system($command4); + $command5 = "chmod 777 " . $picturefile; + system($command5); + $textfile = $fullpath . "/text.txt"; + $command6 = "touch " . $textfile; + system($command6); + $command7 = "chmod 777 " . $textfile; + system($command7); + $textfile2 = $fullpath . "/text2.txt"; + $command77 = "touch ". $textfile2; + system($command77); + $command7777 = "chmod 777 " . $textfile2; + system($command7777); + $pictureupload = $fullpath . "/pictureupload.php"; + $command8 = "touch " . $pictureupload; + system($command8); + $command9 = "chmod 777 " . $pictureupload; + system($command9); + $pictureuploadtext = ""; + open(PICFILE, ">$pictureupload"); + print PICFILE $pictureuploadtext; + close(PICFILE); + $textupload = $fullpath . "/textuploader.php"; + $command10 = "touch " . $textupload; + system($command10); + $command11 = "chmod 777 " . $textupload; + system($command11); + $textuploadtext = ""; + open(TEXTFILE, ">$textupload"); + print TEXTFILE $textuploadtext; + close(TEXTFILE); + $text2upload = $fullpath . "/text2uploader.php"; + $command100 = "touch " . $text2upload; + system($command100); + $command110 = "chmod 777 " . $text2upload; + system($command110); + $text2uploadtext = ""; + open(TEXT2FILE, ">$text2upload"); + print TEXT2FILE $text2uploadtext; + close(TEXT2FILE); + $connectupload = $fullpath . "/connectuploader.php"; + $command12 = "touch " . $connectupload; + system($command12); + $command13 = "chmod 777 " . $connectupload; + system($command13); + $connectuploadtext = ""; + open(CONNECTFILE, ">$connectupload"); + print CONNECTFILE $connectuploadtext; + close(CONNECTFILE); + $getfuncfile = $fullpath . "/getfunc"; + $command6 = "touch " . $getfuncfile; + system($command6); + $command7 = "chmod 777 " . $getfuncfile; + system($command7); + $putfuncfile = $fullpath . "/putfunc"; + $command6 = "touch " . $putfuncfile; + system($command6); + $command7 = "chmod 777 " . $putfuncfile; + system($command7); + $getfuncupload = $fullpath . "/getfuncuploader.php"; + $command10 = "touch " . $getfuncupload; + system($command10); + $command11 = "chmod 777 " . $getfuncupload; + system($command11); + $getfuncuploadtext = ""; + open(GETFUNCUPLOADFILE, ">$getfuncupload"); + print GETFUNCUPLOADFILE $getfuncuploadtext; + close(GETFUNCUPLOADFILE); + $putfuncupload = $fullpath . "/putfuncuploader.php"; + $command10 = "touch " . $putfuncupload; + system($command10); + $command11 = "chmod 777 " . $putfuncupload; + system($command11); + $putfuncuploadtext = ""; + open(PUTFUNCUPLOADFILE, ">$putfuncupload"); + print PUTFUNCUPLOADFILE $putfuncuploadtext; + close(PUTFUNCUPLOADFILE); + while(1){ + $fullpath1 = $webserver. $path . "/connect"; + open(CONNECTFILE, "+<$fullpath1"); + $line= ; + $correctstring = $key . " CONNECT"; + if ($line eq $correctstring) + { + $command = "\n" . $key . " CONNECTED"; + print CONNECTFILE $command; + close(CONNECTFILE); + # print "CONNECTED!\n"; + last; + } + else { + close(CONNECTFILE); + # sleep(1); + } + } + $table = "modems"; + $sqlserver = $Variables{"MYSQLSERVER"}; + $username = $Variables{"MYSQLUSER"}; + $password = $Variables{"MYSQLPASS"}; + $port = $Variables{"MYSQLPORT"}; + $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); + $type = "app"; + $number2 = "\"" . $number . "\""; + $path2 = "\"" . $path . "\""; + $key2 = "\"" . $key . "\""; + $type2 = "\"" . $type . "\""; + $insertquery = "INSERT INTO $table (id,number,path,controlkey,type) VALUES (DEFAULT,$number2,$path2,$key2, $type2)"; + $sql = $dbh->prepare($insertquery); + $sql->execute; + $startcommand = "perl poller.pl " . $path . " " . $key; + $pid = fork; + die "fork failed" unless defined $pid; + if ($pid ==0) + { + system($startcommand); + } + + + +##----- end of your code + +my $url = "menu.pl"; +print "Location: $url\n\n"; diff --git a/frameworkgui/createDatabase.pl b/frameworkgui/createDatabase.pl index 78d0658..047cf2b 100755 --- a/frameworkgui/createDatabase.pl +++ b/frameworkgui/createDatabase.pl @@ -1,64 +1,64 @@ -#!/usr/bin/perl -use DBI; -use Cwd; -$dir = getcwd; -$configfile = $dir . "/config"; - open(CONFIG, "+<$configfile"); -while () -{ - chomp; - s/#.*//; - s/^\s+//; - s/\s+$//; - ($var, $value) = split(/\s*=\s*/, $_, 2); - $Variables{$var} = ${value}; -} -$Variables{"OS"} = $^O; - - $sqlserver = $Variables{"MYSQLSERVER"}; - $username = $Variables{"MYSQLUSER"}; - $password = $Variables{"MYSQLPASS"}; - $port = $Variables{"MYSQLPORT"}; - $dropquery1 = "DROP TABLE IF EXISTS agents"; - $dropquery2 = "DROP TABLE IF EXISTS data"; - $dropquery3 = "DROP TABLE IF EXISTS modems"; - $dropquery4 = "DROP TABLE IF EXISTS remote"; - $dropquery5 = "DROP TABLE IF EXISTS client"; - $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); - $sql = $dbh->prepare($dropquery1); - $sql->execute; - $sql = $dbh->prepare($dropquery2); - $sql->execute; - $sql = $dbh->prepare($dropquery3); - $sql->execute; - $sql = $dbh->prepare($dropquery4); - $sql->execute; - $sql = $dbh->prepare($dropquery5); - $sql->execute; - $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))"; - $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))"; - $createquery5 = "create table client (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, number varchar(12), exploit varchar(200), vuln varchar(3))"; - - $sql = $dbh->prepare($createquery1); - $sql->execute; - $sql = $dbh->prepare($createquery2); - $sql->execute; - $sql = $dbh->prepare($createquery3); - $sql->execute; - $sql = $dbh->prepare($createquery4); - $sql->execute; - $sql = $dbh->prepare($createquery5); - $sql->execute; -#####This sends it back to the main page. - -my $url = "menu.pl"; -print "Location: $url\n\n"; - +#!/usr/bin/perl +use DBI; +use Cwd; +$dir = getcwd; +$configfile = $dir . "/config"; + open(CONFIG, "+<$configfile"); +while () +{ + chomp; + s/#.*//; + s/^\s+//; + s/\s+$//; + ($var, $value) = split(/\s*=\s*/, $_, 2); + $Variables{$var} = ${value}; +} +$Variables{"OS"} = $^O; + + $sqlserver = $Variables{"MYSQLSERVER"}; + $username = $Variables{"MYSQLUSER"}; + $password = $Variables{"MYSQLPASS"}; + $port = $Variables{"MYSQLPORT"}; + $dropquery1 = "DROP TABLE IF EXISTS agents"; + $dropquery2 = "DROP TABLE IF EXISTS data"; + $dropquery3 = "DROP TABLE IF EXISTS modems"; + $dropquery4 = "DROP TABLE IF EXISTS remote"; + $dropquery5 = "DROP TABLE IF EXISTS client"; + $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); + $sql = $dbh->prepare($dropquery1); + $sql->execute; + $sql = $dbh->prepare($dropquery2); + $sql->execute; + $sql = $dbh->prepare($dropquery3); + $sql->execute; + $sql = $dbh->prepare($dropquery4); + $sql->execute; + $sql = $dbh->prepare($dropquery5); + $sql->execute; + $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))"; + $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))"; + $createquery5 = "create table client (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, number varchar(12), exploit varchar(200), vuln varchar(3))"; + + $sql = $dbh->prepare($createquery1); + $sql->execute; + $sql = $dbh->prepare($createquery2); + $sql->execute; + $sql = $dbh->prepare($createquery3); + $sql->execute; + $sql = $dbh->prepare($createquery4); + $sql->execute; + $sql = $dbh->prepare($createquery5); + $sql->execute; +#####This sends it back to the main page. + +my $url = "menu.pl"; +print "Location: $url\n\n"; + diff --git a/frameworkgui/escalatePrivileges.pl b/frameworkgui/escalatePrivileges.pl index 35a113d..450e7e4 100755 --- a/frameworkgui/escalatePrivileges.pl +++ b/frameworkgui/escalatePrivileges.pl @@ -1,93 +1,93 @@ -#!/usr/bin/perl -use Cwd; -use DBI; - -# Read the standard input (sent by the form): -read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); -# Get the name and value for each form input: -@pairs = split(/&/, $FormData); -# Then for each name/value pair.... -foreach $pair (@pairs) { - # Separate the name and value: - ($name, $value) = split(/=/, $pair); - # Convert + signs to spaces: - $value =~ tr/+/ /; - # Convert hex pairs (%HH) to ASCII characters: - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - # Store values in a hash called %FORM: - $FORM{$name} = $value; -} - - -$agent = $FORM{"agentsDD"}; -$delivery = $FORM{"deliveryMethodRB"}; -$modemNo = $FORM{"modemNoDD"}; - - - - - -##----- put your code here -$dir = getcwd; -$configfile = $dir . "/config"; -open(CONFIG, "+<$configfile"); -while () -{ - chomp; - s/#.*//; - s/^\s+//; - s/\s+$//; - ($var, $value) = split(/\s*=\s*/, $_, 2); - $Variables{$var} = ${value}; -} -#print "Content-type: text/html\r\n\r\n"; -$webserver = $Variables{"WEBSERVER"}; - -$Variables{"OS"} = $^O; - $sqlserver = $Variables{"MYSQLSERVER"}; - $username = $Variables{"MYSQLUSER"}; - $password = $Variables{"MYSQLPASS"}; - $port = $Variables{"MYSQLPORT"}; - $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); - $selectquery = "SELECT path from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $path = @rows[0]; -$selectquery = "SELECT controlkey from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $key = @rows[0]; -if ($delivery eq "HTTP") - { - $command = $key . " ROOT HTTP\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - } - if ($delivery eq "SMS") - { - - $selectquery = "SELECT id from modems where number=" . $modemNo; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $modem = @rows[0]; - $command = $key . " " . "ROOT HTTP" . " " . $modem . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - -} -##----- end of your code - -my $url = "menu.pl"; -print "Location: $url\n\n"; - - - - +#!/usr/bin/perl +use Cwd; +use DBI; + +# Read the standard input (sent by the form): +read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); +# Get the name and value for each form input: +@pairs = split(/&/, $FormData); +# Then for each name/value pair.... +foreach $pair (@pairs) { + # Separate the name and value: + ($name, $value) = split(/=/, $pair); + # Convert + signs to spaces: + $value =~ tr/+/ /; + # Convert hex pairs (%HH) to ASCII characters: + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + # Store values in a hash called %FORM: + $FORM{$name} = $value; +} + + +$agent = $FORM{"agentsDD"}; +$delivery = $FORM{"deliveryMethodRB"}; +$modemNo = $FORM{"modemNoDD"}; + + + + + +##----- put your code here +$dir = getcwd; +$configfile = $dir . "/config"; +open(CONFIG, "+<$configfile"); +while () +{ + chomp; + s/#.*//; + s/^\s+//; + s/\s+$//; + ($var, $value) = split(/\s*=\s*/, $_, 2); + $Variables{$var} = ${value}; +} +#print "Content-type: text/html\r\n\r\n"; +$webserver = $Variables{"WEBSERVER"}; + +$Variables{"OS"} = $^O; + $sqlserver = $Variables{"MYSQLSERVER"}; + $username = $Variables{"MYSQLUSER"}; + $password = $Variables{"MYSQLPASS"}; + $port = $Variables{"MYSQLPORT"}; + $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); + $selectquery = "SELECT path from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $path = @rows[0]; +$selectquery = "SELECT controlkey from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $key = @rows[0]; +if ($delivery eq "HTTP") + { + $command = $key . " ROOT HTTP\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + } + if ($delivery eq "SMS") + { + + $selectquery = "SELECT id from modems where number=" . $modemNo; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $modem = @rows[0]; + $command = $key . " " . "ROOT HTTP" . " " . $modem . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + +} +##----- end of your code + +my $url = "menu.pl"; +print "Location: $url\n\n"; + + + + diff --git a/frameworkgui/getContacts.pl b/frameworkgui/getContacts.pl index c483d69..51f1e4d 100755 --- a/frameworkgui/getContacts.pl +++ b/frameworkgui/getContacts.pl @@ -1,136 +1,136 @@ -#!/usr/bin/perl -use DBI; -use Cwd; - -# Read the standard input (sent by the form): -read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); -# Get the name and value for each form input: -@pairs = split(/&/, $FormData); -# Then for each name/value pair.... -foreach $pair (@pairs) { - # Separate the name and value: - ($name, $value) = split(/=/, $pair); - # Convert + signs to spaces: - $value =~ tr/+/ /; - # Convert hex pairs (%HH) to ASCII characters: - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - # Store values in a hash called %FORM: - $FORM{$name} = $value; -} - - -$agent = $FORM{"agentsDD"}; -$deliverymethod = $FORM{"deliveryMethodRB"}; -$returnmethod = $FORM{"returnMethodRB"}; -$modemNo = $FORM{"modemNoDD"}; - - - -##----- put your code here -$dir = getcwd; -$configfile = $dir . "/config"; -open(CONFIG, "+<$configfile"); -while () -{ - chomp; - s/#.*//; - s/^\s+//; - s/\s+$//; - ($var, $value) = split(/\s*=\s*/, $_, 2); - $Variables{$var} = ${value}; -} -#print "Content-type: text/html\r\n\r\n"; -$webserver = $Variables{"WEBSERVER"}; - -$Variables{"OS"} = $^O; - $sqlserver = $Variables{"MYSQLSERVER"}; - $username = $Variables{"MYSQLUSER"}; - $password = $Variables{"MYSQLPASS"}; - $port = $Variables{"MYSQLPORT"}; - $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); - $selectquery = "SELECT path from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $path = @rows[0]; -$selectquery = "SELECT controlkey from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $key = @rows[0]; -if ($returnmethod eq "SMS") - { - - $selectquery = "SELECT id from modems where number=" . $modemNo; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $modem = @rows[0]; - if ($deliverymethod eq "HTTP") - { - $command = $key . " CONT " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - - - } - if ($deliverymethod eq "SMS") - { - $selectquery = "SELECT id from modems where number=" . $modemNo; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $modem = @rows[0]; - $command = $key . " CONT " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - } - } - - - if ($returnmethod eq "HTTP") - { - - if ($deliverymethod eq "HTTP") - { - $command = $key . " CONT " . $deliverymethod . " " . $returnmethod . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - - } - if ($deliverymethod eq "SMS") - { - $selectquery = "SELECT id from modems where number=" . $modemNo; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $modem = @rows[0]; - $command = $key . " CONT " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - - - } - - } - - - - -##----- end of your code - -my $url = "menu.pl"; -print "Location: $url\n\n"; - +#!/usr/bin/perl +use DBI; +use Cwd; + +# Read the standard input (sent by the form): +read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); +# Get the name and value for each form input: +@pairs = split(/&/, $FormData); +# Then for each name/value pair.... +foreach $pair (@pairs) { + # Separate the name and value: + ($name, $value) = split(/=/, $pair); + # Convert + signs to spaces: + $value =~ tr/+/ /; + # Convert hex pairs (%HH) to ASCII characters: + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + # Store values in a hash called %FORM: + $FORM{$name} = $value; +} + + +$agent = $FORM{"agentsDD"}; +$deliverymethod = $FORM{"deliveryMethodRB"}; +$returnmethod = $FORM{"returnMethodRB"}; +$modemNo = $FORM{"modemNoDD"}; + + + +##----- put your code here +$dir = getcwd; +$configfile = $dir . "/config"; +open(CONFIG, "+<$configfile"); +while () +{ + chomp; + s/#.*//; + s/^\s+//; + s/\s+$//; + ($var, $value) = split(/\s*=\s*/, $_, 2); + $Variables{$var} = ${value}; +} +#print "Content-type: text/html\r\n\r\n"; +$webserver = $Variables{"WEBSERVER"}; + +$Variables{"OS"} = $^O; + $sqlserver = $Variables{"MYSQLSERVER"}; + $username = $Variables{"MYSQLUSER"}; + $password = $Variables{"MYSQLPASS"}; + $port = $Variables{"MYSQLPORT"}; + $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); + $selectquery = "SELECT path from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $path = @rows[0]; +$selectquery = "SELECT controlkey from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $key = @rows[0]; +if ($returnmethod eq "SMS") + { + + $selectquery = "SELECT id from modems where number=" . $modemNo; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $modem = @rows[0]; + if ($deliverymethod eq "HTTP") + { + $command = $key . " CONT " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + + + } + if ($deliverymethod eq "SMS") + { + $selectquery = "SELECT id from modems where number=" . $modemNo; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $modem = @rows[0]; + $command = $key . " CONT " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + } + } + + + if ($returnmethod eq "HTTP") + { + + if ($deliverymethod eq "HTTP") + { + $command = $key . " CONT " . $deliverymethod . " " . $returnmethod . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + + } + if ($deliverymethod eq "SMS") + { + $selectquery = "SELECT id from modems where number=" . $modemNo; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $modem = @rows[0]; + $command = $key . " CONT " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + + + } + + } + + + + +##----- end of your code + +my $url = "menu.pl"; +print "Location: $url\n\n"; + diff --git a/frameworkgui/getDatabase.pl b/frameworkgui/getDatabase.pl index 0e0d8f0..cbcbf93 100755 --- a/frameworkgui/getDatabase.pl +++ b/frameworkgui/getDatabase.pl @@ -1,121 +1,121 @@ -#!/usr/bin/perl -use DBI; -use Cwd; - -# Read the standard input (sent by the form): -read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); -# Get the name and value for each form input: -@pairs = split(/&/, $FormData); -# Then for each name/value pair.... -foreach $pair (@pairs) { - # Separate the name and value: - ($name, $value) = split(/=/, $pair); - # Convert + signs to spaces: - $value =~ tr/+/ /; - # Convert hex pairs (%HH) to ASCII characters: - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - # Store values in a hash called %FORM: - $FORM{$name} = $value; -} - - -$agent = $FORM{"agentsDD"}; -$deliverymethod = $FORM{"deliveryMethodRB"}; -$returnmethod = $FORM{"returnMethodRB"}; -$modemNo = $FORM{"modemNoDD"}; - - - -##----- put your code here -$dir = getcwd; -$configfile = $dir . "/config"; -open(CONFIG, "+<$configfile"); -while () -{ - chomp; - s/#.*//; - s/^\s+//; - s/\s+$//; - ($var, $value) = split(/\s*=\s*/, $_, 2); - $Variables{$var} = ${value}; -} -#print "Content-type: text/html\r\n\r\n"; -$webserver = $Variables{"WEBSERVER"}; - -$Variables{"OS"} = $^O; - $sqlserver = $Variables{"MYSQLSERVER"}; - $username = $Variables{"MYSQLUSER"}; - $password = $Variables{"MYSQLPASS"}; - $port = $Variables{"MYSQLPORT"}; - $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); - $selectquery = "SELECT path from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $path = @rows[0]; -$selectquery = "SELECT controlkey from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $key = @rows[0]; -if ($returnmethod eq "SMS") - { - $selectquery = "SELECT id from modems where number=" . $modemNo; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $modem = @rows[0]; - $command = $key . " " . "SMSS" . " " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; - if ($deliverymethod eq "HTTP") - { - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - - } - if ($deliverymethod eq "SMS") - { - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - } - - - } - if ($returnmethod eq "HTTP") - { - if ($deliverymethod eq "HTTP") - { - $command = $key . " SMSS " . $deliverymethod . " " . $returnmethod . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - } - if ($deliverymethod eq "SMS") - { - $selectquery = "SELECT id from modems where number=" . $modemNo; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $modem = @rows[0]; - $command = $key . " SMSS " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - -} -} - -##----- end of your code - -my $url = "menu.pl"; -print "Location: $url\n\n"; - +#!/usr/bin/perl +use DBI; +use Cwd; + +# Read the standard input (sent by the form): +read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); +# Get the name and value for each form input: +@pairs = split(/&/, $FormData); +# Then for each name/value pair.... +foreach $pair (@pairs) { + # Separate the name and value: + ($name, $value) = split(/=/, $pair); + # Convert + signs to spaces: + $value =~ tr/+/ /; + # Convert hex pairs (%HH) to ASCII characters: + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + # Store values in a hash called %FORM: + $FORM{$name} = $value; +} + + +$agent = $FORM{"agentsDD"}; +$deliverymethod = $FORM{"deliveryMethodRB"}; +$returnmethod = $FORM{"returnMethodRB"}; +$modemNo = $FORM{"modemNoDD"}; + + + +##----- put your code here +$dir = getcwd; +$configfile = $dir . "/config"; +open(CONFIG, "+<$configfile"); +while () +{ + chomp; + s/#.*//; + s/^\s+//; + s/\s+$//; + ($var, $value) = split(/\s*=\s*/, $_, 2); + $Variables{$var} = ${value}; +} +#print "Content-type: text/html\r\n\r\n"; +$webserver = $Variables{"WEBSERVER"}; + +$Variables{"OS"} = $^O; + $sqlserver = $Variables{"MYSQLSERVER"}; + $username = $Variables{"MYSQLUSER"}; + $password = $Variables{"MYSQLPASS"}; + $port = $Variables{"MYSQLPORT"}; + $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); + $selectquery = "SELECT path from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $path = @rows[0]; +$selectquery = "SELECT controlkey from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $key = @rows[0]; +if ($returnmethod eq "SMS") + { + $selectquery = "SELECT id from modems where number=" . $modemNo; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $modem = @rows[0]; + $command = $key . " " . "SMSS" . " " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; + if ($deliverymethod eq "HTTP") + { + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + + } + if ($deliverymethod eq "SMS") + { + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + } + + + } + if ($returnmethod eq "HTTP") + { + if ($deliverymethod eq "HTTP") + { + $command = $key . " SMSS " . $deliverymethod . " " . $returnmethod . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + } + if ($deliverymethod eq "SMS") + { + $selectquery = "SELECT id from modems where number=" . $modemNo; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $modem = @rows[0]; + $command = $key . " SMSS " . $deliverymethod . " " . $returnmethod . " " . $modem . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + +} +} + +##----- end of your code + +my $url = "menu.pl"; +print "Location: $url\n\n"; + diff --git a/frameworkgui/myJavaScript.js b/frameworkgui/myJavaScript.js index c0edd41..578ff05 100755 --- a/frameworkgui/myJavaScript.js +++ b/frameworkgui/myJavaScript.js @@ -1,97 +1,97 @@ - - - function resetButtons() - { - document.getElementById("attach").style.display="none"; - document.getElementById("attachRadio").style.display="block"; - document.getElementById("sendCommand").style.display="none"; - document.getElementById("sendCommandRadio").style.display="block"; - document.getElementById("infoGathered").style.display="none"; - document.getElementById("infoGatheredRadio").style.display="block"; - document.getElementById("attachMobileModem").style.display="none"; - document.getElementById("attachMobileModemRadio").style.display="block"; - document.getElementById("remoteAttack").style.display="none"; - document.getElementById("remoteAttackRadio").style.display="block"; - document.getElementById("SEorCSAttack").style.display="none"; - document.getElementById("SEorCSAttackRadio").style.display="block"; - document.getElementById("database").style.display="none"; - document.getElementById("databaseRadio").style.display="block"; - - } - - function resetOptions() - { - document.getElementById("deliveryMethod").style.display="none"; - document.getElementById("returnMethod").style.display="none"; - document.getElementById("message").style.display="none"; - document.getElementById("submitSend").style.display="none"; - document.getElementById("submitPicture").style.display="none"; - document.getElementById("submitContacts").style.display="none"; - document.getElementById("submitGetDatabase").style.display="none"; - document.getElementById("submitEscalate").style.display="none"; - document.getElementById("recipient").style.display="none"; - } - - - - function showDiv(divName, radio) - { - resetButtons(); - document.getElementById(divName).style.display="block"; - document.getElementById(radio).style.display="none"; - } - - function showDiv2(divName) - { - document.getElementById(divName).style.display="block"; - } - - function hideDiv(divName) - { - document.getElementById(divName).style.display="none"; - } - - - function confirmAndCreate() - { - var answer=confirm("This will destroy your data. Are you sure you want to do this?"); - if (answer) - submitForm(1); - } - function showButton(divName) - { - document.getElementById(divName).style.display="block"; - } - function submitForm(which) - { - if (which == 1) - document.forms["main"].action="createDatabase.pl"; - else if (which == 2) - document.forms["main"].action="SEAttack.pl"; - else if (which == 3) - document.forms["main"].action="CSAttack.pl"; - else if (which == 4) - document.forms["main"].action="remoteAttack.pl"; - else if (which == 5) - document.forms["main"].action="search.pl"; - else if (which == 6) - document.forms["main"].action="attachMobileModem.pl"; - else if (which == 7) - document.forms["main"].action="viewInfo.pl"; - else if (which == 8) - document.forms["main"].action="sendSMS.pl"; - else if (which == 9) - document.forms["main"].action="takePic.pl"; - else if (which == 10) - document.forms["main"].action="getContacts.pl"; - else if (which == 11) - document.forms["main"].action="getDatabase.pl"; - else if (which == 12) - document.forms["main"].action="escalatePrivileges.pl"; - else if (which == 13) - document.forms["main"].action="attach2Agents.pl"; - - document.forms["main"].submit(); - } - + + + function resetButtons() + { + document.getElementById("attach").style.display="none"; + document.getElementById("attachRadio").style.display="block"; + document.getElementById("sendCommand").style.display="none"; + document.getElementById("sendCommandRadio").style.display="block"; + document.getElementById("infoGathered").style.display="none"; + document.getElementById("infoGatheredRadio").style.display="block"; + document.getElementById("attachMobileModem").style.display="none"; + document.getElementById("attachMobileModemRadio").style.display="block"; + document.getElementById("remoteAttack").style.display="none"; + document.getElementById("remoteAttackRadio").style.display="block"; + document.getElementById("SEorCSAttack").style.display="none"; + document.getElementById("SEorCSAttackRadio").style.display="block"; + document.getElementById("database").style.display="none"; + document.getElementById("databaseRadio").style.display="block"; + + } + + function resetOptions() + { + document.getElementById("deliveryMethod").style.display="none"; + document.getElementById("returnMethod").style.display="none"; + document.getElementById("message").style.display="none"; + document.getElementById("submitSend").style.display="none"; + document.getElementById("submitPicture").style.display="none"; + document.getElementById("submitContacts").style.display="none"; + document.getElementById("submitGetDatabase").style.display="none"; + document.getElementById("submitEscalate").style.display="none"; + document.getElementById("recipient").style.display="none"; + } + + + + function showDiv(divName, radio) + { + resetButtons(); + document.getElementById(divName).style.display="block"; + document.getElementById(radio).style.display="none"; + } + + function showDiv2(divName) + { + document.getElementById(divName).style.display="block"; + } + + function hideDiv(divName) + { + document.getElementById(divName).style.display="none"; + } + + + function confirmAndCreate() + { + var answer=confirm("This will destroy your data. Are you sure you want to do this?"); + if (answer) + submitForm(1); + } + function showButton(divName) + { + document.getElementById(divName).style.display="block"; + } + function submitForm(which) + { + if (which == 1) + document.forms["main"].action="createDatabase.pl"; + else if (which == 2) + document.forms["main"].action="SEAttack.pl"; + else if (which == 3) + document.forms["main"].action="CSAttack.pl"; + else if (which == 4) + document.forms["main"].action="remoteAttack.pl"; + else if (which == 5) + document.forms["main"].action="search.pl"; + else if (which == 6) + document.forms["main"].action="attachMobileModem.pl"; + else if (which == 7) + document.forms["main"].action="viewInfo.pl"; + else if (which == 8) + document.forms["main"].action="sendSMS.pl"; + else if (which == 9) + document.forms["main"].action="takePic.pl"; + else if (which == 10) + document.forms["main"].action="getContacts.pl"; + else if (which == 11) + document.forms["main"].action="getDatabase.pl"; + else if (which == 12) + document.forms["main"].action="escalatePrivileges.pl"; + else if (which == 13) + document.forms["main"].action="attach2Agents.pl"; + + document.forms["main"].submit(); + } + \ No newline at end of file diff --git a/frameworkgui/picture.jpg b/frameworkgui/picture.jpg new file mode 100755 index 0000000..39201e4 Binary files /dev/null and b/frameworkgui/picture.jpg differ diff --git a/frameworkgui/remoteAttack.pl b/frameworkgui/remoteAttack.pl index 835d8a4..85ee8f8 100755 --- a/frameworkgui/remoteAttack.pl +++ b/frameworkgui/remoteAttack.pl @@ -1,40 +1,40 @@ -#!/usr/bin/perl -use DBI; -use Cwd; -# Read the standard input (sent by the form): -read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); -# Get the name and value for each form input: -@pairs = split(/&/, $FormData); -# Then for each name/value pair.... -foreach $pair (@pairs) { - # Separate the name and value: - ($name, $value) = split(/=/, $pair); - # Convert + signs to spaces: - $value =~ tr/+/ /; - # Convert hex pairs (%HH) to ASCII characters: - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - # Store values in a hash called %FORM: - $FORM{$name} = $value; -} - - -$ipAddress = $FORM{"ipAddressTB"}; - - -##----- put your code here -#print "Content-type: text/html\r\n\r\n"; - -$startcommand = "perl sshattack.pl " . $ipAddress; - $pid = fork; - die "fork failed" unless defined $pid; - if ($pid ==0) - { - - system($startcommand); - - - } -##----- end of your code - -my $url = "menu.pl"; -print "Location: $url\n\n"; +#!/usr/bin/perl +use DBI; +use Cwd; +# Read the standard input (sent by the form): +read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); +# Get the name and value for each form input: +@pairs = split(/&/, $FormData); +# Then for each name/value pair.... +foreach $pair (@pairs) { + # Separate the name and value: + ($name, $value) = split(/=/, $pair); + # Convert + signs to spaces: + $value =~ tr/+/ /; + # Convert hex pairs (%HH) to ASCII characters: + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + # Store values in a hash called %FORM: + $FORM{$name} = $value; +} + + +$ipAddress = $FORM{"ipAddressTB"}; + + +##----- put your code here +#print "Content-type: text/html\r\n\r\n"; + +$startcommand = "perl sshattack.pl " . $ipAddress; + $pid = fork; + die "fork failed" unless defined $pid; + if ($pid ==0) + { + + system($startcommand); + + + } +##----- end of your code + +my $url = "menu.pl"; +print "Location: $url\n\n"; diff --git a/frameworkgui/search.pl b/frameworkgui/search.pl index dce8b9b..c67ada9 100755 --- a/frameworkgui/search.pl +++ b/frameworkgui/search.pl @@ -1,9 +1,9 @@ -##----- put your code here - - - - -##----- end of your code - -my $url = "menu.pl"; -print "Location: $url\n\n"; +##----- put your code here + + + + +##----- end of your code + +my $url = "menu.pl"; +print "Location: $url\n\n"; diff --git a/frameworkgui/sendSMS.pl b/frameworkgui/sendSMS.pl index 2dd2e1f..ca51ca5 100755 --- a/frameworkgui/sendSMS.pl +++ b/frameworkgui/sendSMS.pl @@ -1,92 +1,92 @@ -#!/usr/bin/perl -use DBI; -use Cwd; - -# Read the standard input (sent by the form): -read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); -# Get the name and value for each form input: -@pairs = split(/&/, $FormData); -# Then for each name/value pair.... -foreach $pair (@pairs) { - # Separate the name and value: - ($name, $value) = split(/=/, $pair); - # Convert + signs to spaces: - $value =~ tr/+/ /; - # Convert hex pairs (%HH) to ASCII characters: - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - # Store values in a hash called %FORM: - $FORM{$name} = $value; -} - - -$agent = $FORM{"agentsDD"}; -$deliverymethod = $FORM{"deliveryMethodRB"}; -$sendmessage = $FORM{"messageTB"}; -$sendnumber = $FORM{"recipient"}; -$modemNo = $FORM{"modemNoDD"}; - - - - -##----- put your code here -$dir = getcwd; -$configfile = $dir . "/config"; -open(CONFIG, "+<$configfile"); -while () -{ - chomp; - s/#.*//; - s/^\s+//; - s/\s+$//; - ($var, $value) = split(/\s*=\s*/, $_, 2); - $Variables{$var} = ${value}; -} -#print "Content-type: text/html\r\n\r\n"; -$webserver = $Variables{"WEBSERVER"}; - -$Variables{"OS"} = $^O; - $sqlserver = $Variables{"MYSQLSERVER"}; - $username = $Variables{"MYSQLUSER"}; - $password = $Variables{"MYSQLPASS"}; - $port = $Variables{"MYSQLPORT"}; - $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); - $selectquery = "SELECT path from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $path = @rows[0]; -$selectquery = "SELECT controlkey from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $key = @rows[0]; -if ($deliverymethod eq "HTTP") - { - - $command = $key . " " . "SPAM" . " " . "none" . " " . $deliverymethod . " " . $sendnumber . " " . $sendmessage . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - - } - if ($deliverymethod eq "SMS") - { - $selectquery = "SELECT id from modems where number=" . $modemNo; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $modem = @rows[0]; - $command = $key . " " . "SPAM" . " " . $modem . " " . $deliverymethod . " " . $sendnumber . " " . $sendmessage . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">>$control"); - print CONTROLFILE $command; - close(CONTROLFILE); -} - - -##----- end of your code - -my $url = "menu.pl"; -print "Location: $url\n\n"; - +#!/usr/bin/perl +use DBI; +use Cwd; + +# Read the standard input (sent by the form): +read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); +# Get the name and value for each form input: +@pairs = split(/&/, $FormData); +# Then for each name/value pair.... +foreach $pair (@pairs) { + # Separate the name and value: + ($name, $value) = split(/=/, $pair); + # Convert + signs to spaces: + $value =~ tr/+/ /; + # Convert hex pairs (%HH) to ASCII characters: + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + # Store values in a hash called %FORM: + $FORM{$name} = $value; +} + + +$agent = $FORM{"agentsDD"}; +$deliverymethod = $FORM{"deliveryMethodRB"}; +$sendmessage = $FORM{"messageTB"}; +$sendnumber = $FORM{"recipient"}; +$modemNo = $FORM{"modemNoDD"}; + + + + +##----- put your code here +$dir = getcwd; +$configfile = $dir . "/config"; +open(CONFIG, "+<$configfile"); +while () +{ + chomp; + s/#.*//; + s/^\s+//; + s/\s+$//; + ($var, $value) = split(/\s*=\s*/, $_, 2); + $Variables{$var} = ${value}; +} +#print "Content-type: text/html\r\n\r\n"; +$webserver = $Variables{"WEBSERVER"}; + +$Variables{"OS"} = $^O; + $sqlserver = $Variables{"MYSQLSERVER"}; + $username = $Variables{"MYSQLUSER"}; + $password = $Variables{"MYSQLPASS"}; + $port = $Variables{"MYSQLPORT"}; + $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); + $selectquery = "SELECT path from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $path = @rows[0]; +$selectquery = "SELECT controlkey from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $key = @rows[0]; +if ($deliverymethod eq "HTTP") + { + + $command = $key . " " . "SPAM" . " " . "none" . " " . $deliverymethod . " " . $sendnumber . " " . $sendmessage . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + + } + if ($deliverymethod eq "SMS") + { + $selectquery = "SELECT id from modems where number=" . $modemNo; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $modem = @rows[0]; + $command = $key . " " . "SPAM" . " " . $modem . " " . $deliverymethod . " " . $sendnumber . " " . $sendmessage . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">>$control"); + print CONTROLFILE $command; + close(CONTROLFILE); +} + + +##----- end of your code + +my $url = "menu.pl"; +print "Location: $url\n\n"; + diff --git a/frameworkgui/styles.css b/frameworkgui/styles.css index a9287a9..707493f 100755 --- a/frameworkgui/styles.css +++ b/frameworkgui/styles.css @@ -1,219 +1,219 @@ - - body { - font-weight: bold; - } - - - - input.submitButton { - position: absolute; - - background-color: #ff3; - font-color: #09f; - font-size: 130%; - text-align: right; - background:url(littleBulb.jpg) no-repeat; - height: 42px; - } - - #submitAttach { - left: 500px; - top: 120px; - width: 107px; - - } - - #submitSend { - display: none; - left: 500px; - top: 80px; - width: 97px; - } - #submitPicture { - display: none; - left: 500px; - top: 80px; - width: 167px; - } - #submitContacts { - display: none; - left: 500px; - top: 80px; - width: 169px; - } - #submitGetDatabase { - display: none; - left: 500px; - top: 80px; - width: 177px; - } - #submitEscalate { - display: none; - left: 500px; - top: 80px; - width: 129px; - } - - #submitView { - left: 400px; - top: 60px; - width: 97px; - - } - #submitAttachModemSearch { - display: none; - left: 500px; - top: 80px; - width: 114px; - } - #submitAttachModemAttach { - display: none; - left: 500px; - top: 80px; - width: 107px; - } - #submitRemoteAttack { - display: none; - left: 550px; - top: 60px; - width: 107px; - } - #submitSEAttack, #submitCSAttack { - display: none; - left: 395px; - top: 160px; - width: 107px; - } - #submitDatabase { - left: 350px; - top: 40px; - width: 167px; - } - #submitReturn { - left: 335; - - - } - #attach { - position:relative; - display:none; - } - - #infoGathered, #sendCommand, #attach, #attachMobileModem, #remoteAttack, #SEorCSAttack, #database - { - position:relative; - display:none; - } - #secondColumn { - position: absolute; - left: 250px; - top: 50px; - } - - #attachSmartPhone { - position: absolute; - left: 295px; - top: 40px; - display: none; - } - #ipAddress { - position: absolute; - left: 350px; - top: 60px; - display: none; - } - - #otherInfo { - position: absolute; - left: 520px; - top: 50px; - display: none; - } - #platform2 { - position: absolute; - left: 288px; - top: 50px; - display: none; - } - - #deliveryMethod { - position: absolute; - left: 250px; - top: 50px; - display: none; - } - - #modemNumber { - position: absolute; - left: 250px; - top: 170px; - display: none; - } - #platform1 { - position: absolute; - left: 500px; - top: 50px; - - } - - - #shell { - position: absolute; - left: 230px; - top: 50px; - display: none; - } - - - #hPath { - position: absolute; - left: 230px; - top: 108px; - display: none; - - } - #returnMethod, #recipient { - position: absolute; - left: 250px; - top: 112px; - display: none; - - } - #message { - position: absolute; - left: 250px; - top: 160px; - display: none; - - } - - - form { - border:2px solid #f00; - background-color:#09f; - padding: 20px; - width: 750px; - } - fieldset { - border-width: 8px 0px 8px 0px; - border-style: solid dashed solid dotted - border-color: #ff3; - - } - label { - - display: block; - float: left; - font-weight: bold; - } - legend { - font-size: 18pt; - font-weight: bold; - font-family: georgia; - color: #ff3; - - } - - - - + + body { + font-weight: bold; + } + + + + input.submitButton { + position: absolute; + + background-color: #ff3; + font-color: #09f; + font-size: 130%; + text-align: right; + background:url(littleBulb.jpg) no-repeat; + height: 42px; + } + + #submitAttach { + left: 500px; + top: 120px; + width: 107px; + + } + + #submitSend { + display: none; + left: 500px; + top: 80px; + width: 97px; + } + #submitPicture { + display: none; + left: 500px; + top: 80px; + width: 167px; + } + #submitContacts { + display: none; + left: 500px; + top: 80px; + width: 169px; + } + #submitGetDatabase { + display: none; + left: 500px; + top: 80px; + width: 177px; + } + #submitEscalate { + display: none; + left: 500px; + top: 80px; + width: 129px; + } + + #submitView { + left: 400px; + top: 60px; + width: 97px; + + } + #submitAttachModemSearch { + display: none; + left: 500px; + top: 80px; + width: 114px; + } + #submitAttachModemAttach { + display: none; + left: 500px; + top: 80px; + width: 107px; + } + #submitRemoteAttack { + display: none; + left: 550px; + top: 60px; + width: 107px; + } + #submitSEAttack, #submitCSAttack { + display: none; + left: 395px; + top: 160px; + width: 107px; + } + #submitDatabase { + left: 350px; + top: 40px; + width: 167px; + } + #submitReturn { + left: 335; + + + } + #attach { + position:relative; + display:none; + } + + #infoGathered, #sendCommand, #attach, #attachMobileModem, #remoteAttack, #SEorCSAttack, #database + { + position:relative; + display:none; + } + #secondColumn { + position: absolute; + left: 250px; + top: 50px; + } + + #attachSmartPhone { + position: absolute; + left: 295px; + top: 40px; + display: none; + } + #ipAddress { + position: absolute; + left: 350px; + top: 60px; + display: none; + } + + #otherInfo { + position: absolute; + left: 520px; + top: 50px; + display: none; + } + #platform2 { + position: absolute; + left: 288px; + top: 50px; + display: none; + } + + #deliveryMethod { + position: absolute; + left: 250px; + top: 50px; + display: none; + } + + #modemNumber { + position: absolute; + left: 250px; + top: 170px; + display: none; + } + #platform1 { + position: absolute; + left: 500px; + top: 50px; + + } + + + #shell { + position: absolute; + left: 230px; + top: 50px; + display: none; + } + + + #hPath { + position: absolute; + left: 230px; + top: 108px; + display: none; + + } + #returnMethod, #recipient { + position: absolute; + left: 250px; + top: 112px; + display: none; + + } + #message { + position: absolute; + left: 250px; + top: 160px; + display: none; + + } + + + form { + border:2px solid #f00; + background-color:#09f; + padding: 20px; + width: 750px; + } + fieldset { + border-width: 8px 0px 8px 0px; + border-style: solid dashed solid dotted + border-color: #ff3; + + } + label { + + display: block; + float: left; + font-weight: bold; + } + legend { + font-size: 18pt; + font-weight: bold; + font-family: georgia; + color: #ff3; + + } + + + + diff --git a/frameworkgui/takePic.pl b/frameworkgui/takePic.pl index a4c0cd5..c3b5827 100755 --- a/frameworkgui/takePic.pl +++ b/frameworkgui/takePic.pl @@ -1,89 +1,89 @@ -#!/usr/bin/perl -use DBI; -use Cwd; - -# Read the standard input (sent by the form): -read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); -# Get the name and value for each form input: -@pairs = split(/&/, $FormData); -# Then for each name/value pair.... -foreach $pair (@pairs) { - # Separate the name and value: - ($name, $value) = split(/=/, $pair); - # Convert + signs to spaces: - $value =~ tr/+/ /; - # Convert hex pairs (%HH) to ASCII characters: - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - # Store values in a hash called %FORM: - $FORM{$name} = $value; -} - - -$agent = $FORM{"agentsDD"}; -$delivery = $FORM{"deliveryMethodRB"}; -$modemNo = $FORM{"modemNoDD"}; - - - - -##----- put your code here -$dir = getcwd; -$configfile = $dir . "/config"; -open(CONFIG, "+<$configfile"); -while () -{ - chomp; - s/#.*//; - s/^\s+//; - s/\s+$//; - ($var, $value) = split(/\s*=\s*/, $_, 2); - $Variables{$var} = ${value}; -} -#print "Content-type: text/html\r\n\r\n"; -$webserver = $Variables{"WEBSERVER"}; - -$Variables{"OS"} = $^O; - $sqlserver = $Variables{"MYSQLSERVER"}; - $username = $Variables{"MYSQLUSER"}; - $password = $Variables{"MYSQLPASS"}; - $port = $Variables{"MYSQLPORT"}; - $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); - $selectquery = "SELECT path from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $path = @rows[0]; -$selectquery = "SELECT controlkey from agents where number=" . $agent; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $key = @rows[0]; -if ($delivery eq "HTTP") -{ - $command = $key . " PICT HTTP\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - } - if ($delivery eq "SMS") - { -$selectquery = "SELECT id from modems where number=" . $modemNo; - $sql = $dbh->prepare($selectquery); - $results = $sql->execute; - @rows = $sql->fetchrow_array(); - $modem = @rows[0]; - - $command = $key . " PICT HTTP " . $modem . "\n"; - $control = $webserver . $path . "/putfunc"; - open(CONTROLFILE, ">$control"); - print CONTROLFILE $command; - close(CONTROLFILE); - -} - -##----- end of your code - -my $url = "menu.pl"; -print "Location: $url\n\n"; - +#!/usr/bin/perl +use DBI; +use Cwd; + +# Read the standard input (sent by the form): +read(STDIN, $FormData, $ENV{'CONTENT_LENGTH'}); +# Get the name and value for each form input: +@pairs = split(/&/, $FormData); +# Then for each name/value pair.... +foreach $pair (@pairs) { + # Separate the name and value: + ($name, $value) = split(/=/, $pair); + # Convert + signs to spaces: + $value =~ tr/+/ /; + # Convert hex pairs (%HH) to ASCII characters: + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + # Store values in a hash called %FORM: + $FORM{$name} = $value; +} + + +$agent = $FORM{"agentsDD"}; +$delivery = $FORM{"deliveryMethodRB"}; +$modemNo = $FORM{"modemNoDD"}; + + + + +##----- put your code here +$dir = getcwd; +$configfile = $dir . "/config"; +open(CONFIG, "+<$configfile"); +while () +{ + chomp; + s/#.*//; + s/^\s+//; + s/\s+$//; + ($var, $value) = split(/\s*=\s*/, $_, 2); + $Variables{$var} = ${value}; +} +#print "Content-type: text/html\r\n\r\n"; +$webserver = $Variables{"WEBSERVER"}; + +$Variables{"OS"} = $^O; + $sqlserver = $Variables{"MYSQLSERVER"}; + $username = $Variables{"MYSQLUSER"}; + $password = $Variables{"MYSQLPASS"}; + $port = $Variables{"MYSQLPORT"}; + $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); + $selectquery = "SELECT path from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $path = @rows[0]; +$selectquery = "SELECT controlkey from agents where number=" . $agent; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $key = @rows[0]; +if ($delivery eq "HTTP") +{ + $command = $key . " PICT HTTP\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + } + if ($delivery eq "SMS") + { +$selectquery = "SELECT id from modems where number=" . $modemNo; + $sql = $dbh->prepare($selectquery); + $results = $sql->execute; + @rows = $sql->fetchrow_array(); + $modem = @rows[0]; + + $command = $key . " PICT HTTP " . $modem . "\n"; + $control = $webserver . $path . "/putfunc"; + open(CONTROLFILE, ">$control"); + print CONTROLFILE $command; + close(CONTROLFILE); + +} + +##----- end of your code + +my $url = "menu.pl"; +print "Location: $url\n\n"; + diff --git a/frameworkgui/viewInfo.pl b/frameworkgui/viewInfo.pl index 0e12393..f8af84f 100755 --- a/frameworkgui/viewInfo.pl +++ b/frameworkgui/viewInfo.pl @@ -1,148 +1,148 @@ -#!/usr/bin/perl - -use DBI; -use Cwd; -$dir = getcwd; - -$configfile = $dir . "/config"; - - open(CONFIG, "+<$configfile"); - -while () - -{ - - chomp; - - s/#.*//; - - s/^\s+//; - - s/\s+$//; - - ($var, $value) = split(/\s*=\s*/, $_, 2); - - $Variables{$var} = ${value}; - -} - -$Variables{"OS"} = $^O; - - - - $sqlserver = $Variables{"MYSQLSERVER"}; - - $username = $Variables{"MYSQLUSER"}; - - $password = $Variables{"MYSQLPASS"}; - - $port = $Variables{"MYSQLPORT"}; - $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); - -print "Content-type: text/html \n\n"; - -print <<"EOT"; - - - - - - - - -
-
-
- -

- - - - -EOT - - - - - - - $query1 = "SELECT id, number from agents"; - $sql1 = $dbh->prepare($query1); - $q1Out = $sql1->execute; - while (($id, $number) = $sql1->fetchrow_array()) - { - - $query2 = "SELECT sms, contacts, picture, root from data where id=$id"; - $sql2 = $dbh->prepare($query2); - $q2Out = $sql2->execute; - ($sms, $contacts, $picture, $root) = $sql2->fetchrow_array(); - print ""; - } - -print <<"EOT"; - -
AGENT DATA
AgentSMS DatabaseContactsPicture LocationRooted?
$number$sms$contacts$picture $root
-

- - - - - - -EOT - - - - $query3 = "SELECT ip, exploit, vuln, agent from remote"; - $sql3 = $dbh->prepare($query3); - $sq1Out = $sql3->execute; - while (($ip, $exploit, $vuln, $agent) = $sql3->fetchrow_array()) - { - - - print ""; - } - -print <<"EOT"; - -
REMOTE ATTACKS
IPExploitVULNAgent
$ip$exploit$vuln$agent
-

- - - - - - -EOT - - - - $query4 = "SELECT number, exploit, vuln from client"; - $sql4 = $dbh->prepare($query4); - $sq1Out = $sql4->execute; - while (($number, $exploit, $vuln) = $sql4->fetchrow_array()) - { - - - print ""; - } - -print <<"EOT"; - -
CLIENT SIDE ATTACKS
NumberExploitVULN
$number$exploit$vuln
-

- -
 
  -
-
-
- - - - - - -EOT - - - +#!/usr/bin/perl + +use DBI; +use Cwd; +$dir = getcwd; + +$configfile = $dir . "/config"; + + open(CONFIG, "+<$configfile"); + +while () + +{ + + chomp; + + s/#.*//; + + s/^\s+//; + + s/\s+$//; + + ($var, $value) = split(/\s*=\s*/, $_, 2); + + $Variables{$var} = ${value}; + +} + +$Variables{"OS"} = $^O; + + + + $sqlserver = $Variables{"MYSQLSERVER"}; + + $username = $Variables{"MYSQLUSER"}; + + $password = $Variables{"MYSQLPASS"}; + + $port = $Variables{"MYSQLPORT"}; + $dbh = DBI->connect("dbi:mysql:database=framework;host=$sqlserver;port=$port", $username,$password); + +print "Content-type: text/html \n\n"; + +print <<"EOT"; + + + + + + + + +
+
+
+ +

+ + + + +EOT + + + + + + + $query1 = "SELECT id, number from agents"; + $sql1 = $dbh->prepare($query1); + $q1Out = $sql1->execute; + while (($id, $number) = $sql1->fetchrow_array()) + { + + $query2 = "SELECT sms, contacts, picture, root from data where id=$id"; + $sql2 = $dbh->prepare($query2); + $q2Out = $sql2->execute; + ($sms, $contacts, $picture, $root) = $sql2->fetchrow_array(); + print ""; + } + +print <<"EOT"; + +
AGENT DATA
AgentSMS DatabaseContactsPicture LocationRooted?
$number$sms$contacts$picture $root
+

+ + + + + + +EOT + + + + $query3 = "SELECT ip, exploit, vuln, agent from remote"; + $sql3 = $dbh->prepare($query3); + $sq1Out = $sql3->execute; + while (($ip, $exploit, $vuln, $agent) = $sql3->fetchrow_array()) + { + + + print ""; + } + +print <<"EOT"; + +
REMOTE ATTACKS
IPExploitVULNAgent
$ip$exploit$vuln$agent
+

+ + + + + + +EOT + + + + $query4 = "SELECT number, exploit, vuln from client"; + $sql4 = $dbh->prepare($query4); + $sq1Out = $sql4->execute; + while (($number, $exploit, $vuln) = $sql4->fetchrow_array()) + { + + + print ""; + } + +print <<"EOT"; + +
CLIENT SIDE ATTACKS
NumberExploitVULN
$number$exploit$vuln
+

+ +
 
  +
+
+
+ + + + + + +EOT + + +