Skip to content

Commit

Permalink
Major changes, but no longer works
Browse files Browse the repository at this point in the history
  • Loading branch information
crock committed Nov 23, 2017
1 parent 665b7e9 commit ad3b023
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 46 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.vscode/
.vscode/
.idea/
test.html
lib/__pycache__
26 changes: 7 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
**CONSIDER THIS SCRIPT ABANDONED AND NO LONGER WORKING. BLAME THE SARAHAH DEVELOPER, NOT ME.**


# Sarahah Spam Bot

With this script, you can spam any user on Sarahah with a message of your choice.

### Compatibility

Python 2 or 3+
Python 3+

### Requirements

Requires a proxy to work successfully. I do not include any proxies with the script, so you will have to obtain these on your own from a third-party.

Once you obtain a proxy, fill in the proxy info in `proxies.json` then save the file.
Once you obtain some proxies, paste them (one per line) in `proxies.txt`

### Installation and Usage

Expand All @@ -21,32 +24,17 @@ Once you obtain a proxy, fill in the proxy info in `proxies.json` then save the

2. Open Terminal on Mac or CMD on Windows

3. Run the following command to install the dependencies:

**Python 2**
3. Run the following command in your terminal to install the dependencies:

```
pip install requests
```

**Python 3**

```
pip3 install requests
```

4. Run the script like this

**Python 2**

```
python SarahahBot.py URL OPTION COUNT
```

**Python 3**

```
python3 SarahahBot.py USERNAME TEXT COUNT
python SarahahBot.py USERNAME TEXT COUNT
```

**EXAMPLE**
Expand Down
92 changes: 69 additions & 23 deletions SarahahBot.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
#! /usr/bin/env python3
# Python Standard Modules
import sys
import os
import json
import random
import threading
from queue import Queue
import time

# PyPi Modules (must be installed with pip command)
import requests

# User Modules
from lib.proxy import *

# Arguments
username = str(sys.argv[1])
text = str(sys.argv[2])
Expand All @@ -15,23 +24,27 @@
sendMessage = "https://%s.sarahah.com/Messages/SendMessage" % username
thankyou = "http://www.sarahah.com/messages/thankyou"

file = open("proxies.json", "r")
proxies = json.load(file)
file.close()

s = requests.Session()
q = Queue()
print_lock = threading.Lock()

def spam(page):
def get_tokens(page):
recipId = page.text.split('<input id="RecipientId" type="hidden" value="')[1].split('"')[0]
csrftoken = page.text.split('<input name="__RequestVerificationToken" type="hidden" value="')[1].split('"')[0]

payload = {
"__RequestVerificationToken": csrftoken,
"userId": recipId,
"text": text
return (recipId, csrftoken)

def get_payload(tokens):
return {
"__RequestVerificationToken": tokens[1],
"userId": tokens[0],
"text": text,
"captchaResponse": None

}

headers = {
def get_headers():
return {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Host": "%s.sarahah.com" % username,
"Origin": url,
Expand All @@ -43,23 +56,56 @@ def spam(page):
'X-Requested-With': 'XMLHttpRequest'
}

def requestJob(proxy):
if check_proxy(proxy):
with print_lock:
print("%s is working" % proxy)

def threader():
while True:
item = q.get()
requestJob(item)
q.task_done()

def main():
proxies = get_proxy_list()
if proxies is not None:
print("Checking and filtering out bad proxies...")
start = time.time()

for x in range(10):
t = threading.Thread(target = threader)
t.daemon = True
t.start()

for item in proxies:
q.put(item)

q.join()

total = str(time.time()-start)
numBad = len(bad_proxies)
numProxies = len(proxies)
print("\nSearched %s proxies and filtered out %s bad proxies in %s seconds" % (numProxies, numBad, total))

headers = get_headers()

for c in range(1, count+1):
res = s.post(sendMessage, data=payload, headers=headers, proxies=proxies)
tempSess = requests.Session()
i = random.randrange(0, good_proxies.__len__())
sess = set_proxy(tempSess, good_proxies[i])
res = sess.get(url, headers=headers)
# tempFile = open('test.html', 'w')
# tempFile.write(res.text)
# tempFile.close()
tokens = get_tokens(res)
payload = get_payload(tokens)
res = sess.post(sendMessage, data=payload, headers=headers)
if res.status_code == 200:
print('Successfully spammed "%s" to %s %s time(s)' % (text, username, str(c)))
else:
print("Spam failed.")
break

if len(sys.argv) != 4:
print('Invalid usage.\n Correct arguments:\n username, message, count \n\nExample usage:\n python VoteBot.py crocbuzz "Hello dear friend" 10')
else:
if (text == "") or (count <= 1):
print('Error:\nthe text arugment must be surrounded in quotation marks\nthe count argument must be greater than 1')
else:
r = s.get(url, proxies=proxies)
if r.status_code == 200:
print("Running Sarahah spam bot...")
spam(r)
else:
print('Connection error, perhaps the server is down?')
if __name__ == "__main__":
main()
31 changes: 31 additions & 0 deletions lib/proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import requests

good_proxies = []
bad_proxies = []

def get_proxy_list():
fx = open('proxies.txt', 'r')
proxies = fx.read().split('\n')
fx.close()

return proxies

def set_proxy(session, proxy):
if proxy != 'none':
session.proxies.update({
'http:' : 'http://' + proxy,
'https:' : 'https://' + proxy
})
return session

def check_proxy(proxy):
ps = requests.Session()
try:
session = set_proxy(ps, proxy)
r = session.get('https://google.com', timeout=4)
if r.status_code is 200:
good_proxies.append(proxy)
return True
except r.raise_for_status():
bad_proxies.append(proxy)
return False
3 changes: 0 additions & 3 deletions proxies.json

This file was deleted.

44 changes: 44 additions & 0 deletions proxies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
167.114.47.231:3128
165.227.53.107:3128
189.90.255.61:8080
94.177.175.232:3128
5.196.189.50:8080
203.146.82.253:3128
180.247.12.6:8080
165.84.167.54:8080
143.0.188.26:80
190.121.158.114:8080
203.58.117.34:80
27.54.116.71:80
159.255.163.178:80
83.174.63.181:80
36.67.30.26:80
59.126.48.8:80
104.41.51.173:80
13.73.1.69:80
13.73.25.58:80
91.191.173.37:808
203.202.251.42:80
204.12.155.204:3128
202.44.109.208:8080
186.42.185.114:65103
169.239.46.110:53281
187.125.100.170:8080
190.18.134.27:8080
85.90.199.59:53281
191.103.252.169:53281
81.30.181.181:8080
49.231.196.114:53281
187.60.160.46:8080
170.79.16.19:8080
99.232.234.15:3128
194.60.226.76:8080
194.126.182.30:53281
77.252.139.246:8080
198.27.115.40:8080
1.179.181.149:8080
180.250.8.74:8080
180.148.211.179:53281
175.29.177.17:8080
103.87.136.242:8080
187.1.57.1:53281

0 comments on commit ad3b023

Please sign in to comment.