Last active
December 31, 2015 18:29
-
-
Save alecnunn/8027347 to your computer and use it in GitHub Desktop.
Added automatic insertion into the database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randrange | |
| from random import choice | |
| import _mysql | |
| db = _mysql.connect(host="localhost", user="root", passwd="P@ssw0rd", db="pbnjout") | |
| i = 1 | |
| while True: | |
| os = ["Unix", "Linux", "Windows Server"] | |
| status = ["success", "important"] | |
| spicked=choice(status) | |
| s2 = choice(status) | |
| s3 = choice(status) | |
| hostname = ["navy", "website", "forum", "army", "military", "ship", "air force", "database", "group", "network"] | |
| not_valid= [10,127,169,172,192] #private IP ranges will not be generated | |
| first=randrange(1,256) | |
| while first in not_valid: | |
| first=randrange(1,256) | |
| ip=".".join([str(first),str(randrange(1,256)),str(randrange(1,256)), str(randrange(1,256))]) | |
| ospicked = choice(os) | |
| host = "-".join([choice(hostname), choice(hostname)]) | |
| quer = """INSERT INTO `results` (`mid`,`ip`,`hostname`,`os`,`80`,`8080`,`443`) VALUES ("{0}","{1}","{2}","{3}","{4}","{5}","{6}");""".format(i, str(ip), str(host), str(ospicked), str(spicked), str(s2), str(s3)) | |
| print str(i) + " entries have been inserted into the database" | |
| db.query(quer) | |
| i = i + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment