diff --git a/Main.py b/Main.py new file mode 100644 index 00000000..6f579754 --- /dev/null +++ b/Main.py @@ -0,0 +1,250 @@ +#!/usr/bin/env python + +#################################################### +# # +# This bot only works with https://strawpoll.de. # +# # +#################################################### +# Usage: Main.py [options] +# +# Options: +# -h, --help show this help message and exit +# -v VOTES, --votes=VOTES +# number of votes to give +# -s SURVEY, --survey=SURVEY +# id of the survey +# -t TARGET, --target=TARGET +# checkbox to vote for +# -f, --flush Deletes skipping proxy list +# +# EXAMPLE +# +# python Main.py -v 10 -s abbcw17 -t check3537987 +# +# + + + +try: + from xml.dom import minidom + import xml.etree.cElementTree as ET + from optparse import OptionParser + import sys + import os +except ImportError as msg: + print("[-] Library not installed: " + str(msg)) + exit() + +try: + import requests +except ImportError: + print("[-] Missing library 'requests'") + print("[*] Please install missing library with: pip install requests") + +# Creator: Luis Hebendanz +class Main: + + # SETTINGS + maxVotes = 1 + voteFor = "" + surveyId = "" + + # GLOBAL VARIABLES + proxyListFile = "https-proxy-list.xml" + saveStateFile = "saveState.xml" + proxyTimeout = 10 # Seconds + currentProxyPointer = 0 + successfulVotes = 0 + + def __init__(self): + try: + + ### + # Command line argument parser + ### + parser = OptionParser() + parser.add_option("-v", "--votes", action="store", type="string", dest="votes",help="number of votes to give") + parser.add_option("-s", "--survey", action="store", type="string", dest="survey",help="id of the survey") + parser.add_option("-t", "--target", action="store", type="string", dest="target", help="checkbox to vote for") + parser.add_option("-f", "--flush", action="store_true", dest="flush",help="Deletes skipping proxy list") + (options, args) = parser.parse_args() + + if len(sys.argv) > 2: + if options.votes is None: + print("[-] Number of votes not defined with: -v ") + exit(1) + if options.survey is None: + print("[-] Survey id not defined with: -s") + exit(1) + if options.target is None: + print("[-] Target to vote for is not defined with: -t") + exit(1) + try: + self.maxVotes = int(options.votes) + except ValueError: + print("[-] Please define an integer for -v") + + # Save arguments into global variable + self.voteFor = options.target + self.surveyId = options.survey + + # Flush saveState.xml + if options.flush == True: + print("[*] Flushing saveState.xml file...") + os.remove(self.saveStateFile) + + # Print help + else: + print("[-] Not enough arguments given") + print() + parser.print_help() + exit() + + # Read proxy list file + alreadyUsedProxy = False + xmldoc = minidom.parse(self.proxyListFile) + taglist = xmldoc.getElementsByTagName('para') + tagList2 = None + + # Check if saveState.xml exists and read file + if os.path.isfile(self.saveStateFile): + xlmSave = minidom.parse(self.saveStateFile) + tagList2 = xlmSave.getElementsByTagName("usedProxy") + + # Print remaining proxies + if tagList2 is not None: + print("[*] Number of remaining proxies in list: " + str(len(taglist) - len(tagList2))) + print() + else: + print("[*] Number of proxies in new list: " + str(len(taglist))) + print() + + # Go through proxy list + for tag in taglist: + + # Check if max votes has been reached + if self.successfulVotes >= self.maxVotes: + break + + # Increase number of used proxy integer + self.currentProxyPointer += 1 + + # Read value out of proxy list + tagValue = tag.childNodes[0].nodeValue + + # Read in saveState.xml if this proxy has already been used + if tagList2 is not None: + for tag2 in tagList2: + if tagValue == tag2.childNodes[0].nodeValue: + alreadyUsedProxy = True + break + + # If it has been used print message and continue to next proxy + if alreadyUsedProxy == True: + print("["+ str(self.currentProxyPointer) +"] Skipping proxy: " + tagValue) + alreadyUsedProxy = False + continue + + # Print current proxy information + print("["+ str(self.currentProxyPointer) +"] New proxy: " + tagValue) + print("[*] Connecting... ") + + # Connect to strawpoll and send vote + self.sendToWebApi('https://' + tagValue) + + # Write used proxy into saveState.xml + self.writeUsedProxy(tagValue) + print() + + # Check if max votes has been reached + if self.successfulVotes >= self.maxVotes: + print("[+] Finished voting: " + str(self.successfulVotes)) + else: + print("[+] Finished every proxy!") + + exit() + except IOError as ex: + print("[-] " + ex.strerror + ": " + ex.filename) + + except KeyboardInterrupt as ex: + print("[*] Saving last proxy...") + print("[*] Programm aborted") + exit() + + + def getClientIp(self, httpProxy): + proxyDictionary = {"https": httpProxy} + rsp = requests.get("https://api.ipify.org/", proxies=proxyDictionary) + return str(rsp.text) + + + def writeUsedProxy(self, proxyIp): + if os.path.isfile(self.saveStateFile): + # Read file + tree = ET.parse(self.saveStateFile) + # Get tag + root = tree.getroot() + child = ET.Element("usedProxy") + child.text = str(proxyIp) + root.append(child) + # Write to file + tree.write(self.saveStateFile, encoding="UTF-8") + else: + # Create tag + root = ET.Element("article") + # Get element tree + tree = ET.ElementTree(root) + # Write to file + tree.write(self.saveStateFile, encoding="UTF-8") + + # Now write defined entry into file + self.writeUsedProxy(proxyIp) + + + + def sendToWebApi(self, httpsProxy): + try: + headers = \ + { + 'Host': 'strawpoll.de', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0', + 'Accept': '*/*', + 'Accept-Language': 'de,en-US;q=0.7,en; q=0.3', + 'Referer': 'https://strawpoll.de/' + self.surveyId, + 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', + 'X-Requested-With': 'XMLHttpRequest', + 'Content-Length': '29', + 'Cookie': 'lang=de', + 'DNT': '1', + 'Connection': 'close' + } + payload = {'pid': self.surveyId, 'oids': self.voteFor} + proxyDictionary = {"https": httpsProxy} + + # Connect to server + r = requests.post('https://strawpoll.de/vote', data=payload, headers=headers, proxies=proxyDictionary, timeout=self.proxyTimeout) + json = r.json() + + # Check if succeeded + if(bool(json['success'])): + print("[+] Successfully voted.") + self.successfulVotes += 1 + return True + else: + print("[-] Voting failed. This Ip already voted.") + return False + + except requests.exceptions.Timeout as ex: + print("[-] Timeout") + return False + + except requests.exceptions.ConnectionError as ex: + print("[-] Couldn't connect to proxy") + return False + + except Exception as ex: + print(str(ex)) + return False + +# Execute main +Main() diff --git a/https-proxy-list.xml b/https-proxy-list.xml new file mode 100644 index 00000000..a28b147b --- /dev/null +++ b/https-proxy-list.xml @@ -0,0 +1,233 @@ + + +
+ 149.56.160.23:80 + 193.108.38.23:80 + 94.56.130.89:3128 + 210.101.131.229:8080 + 139.59.104.222:8080 + 125.31.19.26:80 + 115.249.2.192:8080 + 1.82.216.134:80 + 137.74.254.198:3128 + 58.97.81.11:80 + 104.153.120.97:80 + 104.236.61.99:8080 + 200.29.191.149:3128 + 94.142.142.140:3128 + 117.239.114.246:80 + 111.13.109.27:80 + 149.56.160.23:3128 + 94.177.234.167:3128 + 94.177.234.167:80 + 94.177.234.167:8080 + 103.243.141.43:3128 + 192.99.58.80:3128 + 94.177.227.117:3128 + 94.177.251.179:9000 + 103.243.141.43:80 + 192.99.58.80:80 + 94.177.232.250:3128 + 104.199.146.27:3128 + 144.217.80.91:3128 + 158.69.201.48:3128 + 165.138.174.131:8080 + 130.211.149.61:8080 + 89.36.216.80:8080 + 158.69.5.8:8080 + 144.217.5.51:8080 + 158.69.52.120:8888 + 163.172.211.141:3128 + 46.97.0.186:8080 + 138.0.152.162:3128 + 52.59.218.217:1597 + 177.67.82.86:3128 + 182.92.150.236:3128 + 177.67.82.109:80 + 177.67.82.109:3128 + 201.16.147.193:80 + 162.243.127.148:80 + 162.243.37.55:3128 + 163.53.186.50:8080 + 192.198.84.28:8080 + 177.23.146.46:3128 + 162.243.84.195:3128 + 159.203.172.253:8799 + 187.60.36.126:3128 + 128.199.215.91:3333 + 185.58.226.139:8080 + 62.78.53.198:8080 + 179.108.174.189:8080 + 200.121.233.212:8080 + 1.234.23.22:8088 + 177.22.36.90:3130 + 191.102.93.253:8080 + 188.36.102.60:8080 + 177.125.26.70:8080 + 109.254.6.40:8080 + 146.120.95.1:8000 + 162.243.117.143:8080 + 167.114.223.26:8080 + 78.152.242.180:3128 + 89.36.216.80:3128 + 35.163.151.59:80 + 125.209.116.29:8080 + 54.67.127.113:8083 + 167.114.223.26:3128 + 75.126.131.234:8888 + 94.177.240.118:80 + 92.63.194.17:3128 + 94.177.225.12:3128 + 77.73.64.170:3128 + 177.125.61.33:8080 + 168.63.24.174:8119 + 89.203.221.22:8080 + 93.188.163.57:8080 + 121.32.251.45:80 + 188.166.114.30:8888 + 46.216.7.36:8080 + 185.58.226.139:3128 + 201.209.48.1:8089 + 182.253.178.18:3128 + 190.81.174.205:3128 + 101.109.94.167:8080 + 101.109.134.234:8080 + 217.237.149.151:80 + 217.237.150.55:80 + 217.237.149.215:80 + 213.184.125.71:8080 + 177.129.191.162:80 + 223.196.86.244:8080 + 131.161.255.234:8080 + 186.176.226.154:3128 + 106.46.136.25:808 + 111.177.4.212:9999 + 167.114.223.26:80 + 183.214.114.74:8998 + 92.222.95.178:9999 + 181.215.121.116:8080 + 212.5.221.8:8888 + 177.37.162.25:3128 + 196.210.183.110:8080 + 177.67.81.96:8080 + 107.0.68.29:3128 + 123.231.250.14:3128 + 177.42.176.245:8080 + 86.105.52.52:80 + 178.141.253.235:65000 + 62.113.251.7:8080 + 23.105.192.176:3128 + 101.51.100.175:8080 + 177.54.153.252:3128 + 31.31.77.107:3128 + 177.207.139.171:8080 + 90.76.125.28:3128 + 182.53.134.240:8080 + 94.177.231.118:8080 + 89.40.114.58:3128 + 191.241.36.154:3128 + 192.99.31.180:8080 + 183.89.20.214:8000 + 192.99.68.198:3128 + 192.241.138.142:80 + 101.128.100.185:8080 + 167.114.218.7:8080 + 118.175.226.61:8080 + 162.243.84.195:80 + 158.69.201.249:3128 + 159.203.161.112:8080 + 144.217.61.149:3128 + 144.217.5.51:3128 + 144.217.186.77:8080 + 138.197.50.244:8080 + 104.196.243.162:80 + 104.199.123.28:80 + 104.206.168.153:3128 + 159.203.63.227:3128 + 131.255.82.103:8080 + 139.59.230.250:3128 + 195.225.123.14:3128 + 128.199.229.21:3128 + 178.60.28.98:9999 + 45.117.76.25:3128 + 78.160.160.107:8080 + 203.19.34.146:8080 + 200.54.108.54:80 + 86.105.53.41:80 + 139.59.23.147:3128 + 177.136.252.7:3128 + 91.242.163.174:80 + 111.125.66.25:8080 + 94.177.242.42:1907 + 122.155.3.143:3128 + 138.68.164.97:8080 + 137.135.166.225:8146 + 176.221.69.58:8080 + 202.56.203.40:80 + 212.224.76.176:80 + 128.199.69.153:8080 + 91.237.150.68:8080 + 202.111.175.97:8080 + 41.215.7.94:8080 + 86.120.79.89:3128 + 177.67.84.233:80 + 121.40.40.182:80 + 141.101.49.129:3128 + 31.207.215.231:8080 + 187.44.1.167:8080 + 80.191.214.114:8080 + 177.54.147.15:3128 + 177.21.246.30:8080 + 180.183.208.45:8080 + 177.74.223.61:8080 + 78.188.222.234:8080 + 201.208.184.58:8080 + 77.73.65.182:80 + 200.68.83.249:3129 + 144.217.49.233:8080 + 178.62.127.13:8080 + 138.197.2.73:80 + 177.87.10.162:8080 + 78.138.128.122:8080 + 85.255.10.204:80 + 91.187.180.13:36555 + 191.98.183.138:8080 + 77.73.66.176:3128 + 147.75.205.65:8118 + 120.76.79.24:80 + 178.57.106.218:80 + 103.250.68.186:8080 + 200.17.131.149:8080 + 159.213.118.44:3128 + 123.7.115.141:9797 + 39.80.135.101:8998 + 85.185.30.103:8080 + 89.22.132.57:8080 + 137.135.166.225:8147 + 94.230.243.6:8080 + 36.78.48.240:8080 + 177.66.192.210:8080 + 12.33.254.195:3128 + 177.74.223.109:8080 + 70.169.24.2:8080 + 125.31.19.27:80 + 91.217.42.2:8080 + 45.40.143.57:80 + 137.135.166.225:8120 + 195.158.139.46:3128 + 124.244.149.162:3128 + 118.172.17.44:8080 + 201.163.113.74:8080 + 73.226.92.196:8081 + 27.131.47.132:8080 + 202.152.40.28:8080 + 187.190.248.161:3128 + 79.174.160.163:8080 + 177.55.253.68:8080 + 176.12.125.198:8080 + 118.174.112.108:8080 + 16.250.65.64:80 + 191.5.114.138:8080 + 84.11.84.42:8080 + 154.16.93.1:8080 +
diff --git a/saveState.xml b/saveState.xml new file mode 100644 index 00000000..daae5850 --- /dev/null +++ b/saveState.xml @@ -0,0 +1 @@ +
149.56.160.23:80193.108.38.23:8094.56.130.89:3128