def brute_force(body,controlList): md5 = json.loads(body)["md5"] i = 0 found = False pw = "" while not found and i< max: if (controlList[md5] == 1): return Reply(md5,"","Worker aborted") pw = force(i, 0, "", md5,controlList) i += 1 found = pw != "" return Reply(md5, pw, None)
def wechat_auth(): if request.method == 'GET': token = 'dengruchao' data = request.args signature = data.get('signature', '') timestamp = data.get('timestamp', '') nonce = data.get('nonce', '') echostr = data.get('echostr', '') list1 = [token, timestamp, nonce] list1.sort() sha1 = hashlib.sha1() map(sha1.update, list1) hashcode = sha1.hexdigest() if hashcode == signature: response = make_response(echostr) response.content_type = 'text' return response else: return 'Hello World' else: recv = request.stream.read() xml_recv = ET.fromstring(recv) fromUserName = xml_recv.find('FromUserName').text reply = Reply(fromUserName) return reply.dispatch(recv)
def __init__(self): self.reply = Reply('V6z-Vb-AGcAqfqxZxds3mQ2') self.basePath = self.reply.basePath self.version = self.reply.version self.headers = self.reply.headers self.session = requests.Session() self.session.headers.update(self.headers)
def setUp(self): self.reply = Reply('test-api-key') self.request = helpers.RawRequest() self.sanitizer = helpers.Sanitizer() # Create people for each in resources.people: res = self.request.createPeople(each) self.sanitizer.getId(res)
def run(self): import sys from reply import Reply try: logging.info("%s: Starting reply" % (time.strftime("%d%b%Y,%H:%M")) ) rep = Reply() rep.run() except SystemExit: logging.error("%s: Gateway SIGTERM, exiting" % time.strftime("%d%b%Y,%H:%M")) sys.exit(0)
def call_api(body,controlList): url = "http://md5cracker.org/api/api.cracker.php?r=1140&database=md5cracker.org&hash=" md5 = json.loads(body)["md5"] url += md5 req = Request(url) pw = "" err = None try: res = urlopen(req) text = res.read().decode("utf-8") pw = json.loads(text)["result"] except HTTPError as e: err = e return Reply(md5, pw, err)
def create_reply(self, message, parent): reply = Reply(message, self, datetime.now(), parent) parent.replies.append(reply) return reply
"""This is a dummy version of server_main. Only ran locally, and does not support reminders""" from reply import Reply from credentials import Credentials from callybot_database import CallybotDB import logg import sys sys.stdout = logg.Logger(sys.stdout, open('dummylog.txt', 'a')) # Writes to file and console credential = Credentials() db_credentials = credential.db_info db = CallybotDB(db_credentials[0], db_credentials[1], db_credentials[2], db_credentials[3]) replier = Reply(credential.access_token, db) joachim_jahr_id = "1550995208259075" while True: inn = input("Input message: ") data = {'entry': [{'messaging': [{'message': {'text': inn}}]}]} print(replier.arbitrate(joachim_jahr_id, data))