Skip to content

Commit

Permalink
add apikey to config
Browse files Browse the repository at this point in the history
  • Loading branch information
harryhare committed Aug 1, 2021
1 parent 4c414c6 commit acb280e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,5 @@ dmypy.json
*.gif
*.png
*.html

test_2captcha.py
13 changes: 9 additions & 4 deletions configure/data.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[{
"username": "replace_with_your_username",
"password": "repalce_with_your_password"
}]
{
"users": [
{
"username": "replace_with_your_username",
"password": "repalce_with_your_password"
}
],
"api_key": "replace_with_your_api_Key"
}
8 changes: 5 additions & 3 deletions src/raw_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import get_cf_clearance

user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0"
#user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleW..."
#user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
# user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleW..."
# user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"

referer = "https://www.1point3acres.com/bbs/"

Expand Down Expand Up @@ -252,7 +252,9 @@ def do_daily_checkin_(verify_code: str, form_hash: str, sec_hash: str = "S00") -
"todaysay": None,
"fastreply": 14,
"sechash": sec_hash,
"seccodeverify": verify_code
"seccodehash": sec_hash,
"seccodeverify": sec_hash,
"g-recaptcha-response": "",
}

response = requests.post(post_checkin_url, headers=header, data=body, cookies=cookie_jar)
Expand Down
23 changes: 15 additions & 8 deletions src/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def daily_login(username: str, password_hashed: str):
return login(username, password_hashed, form_hash, login_hash)


def daily_checkin() -> bool:
def daily_checkin(api_key: str) -> bool:
print("do daily checkin...")
form_hash, sec_hash = get_checkin_info_()
time.sleep(2)
Expand All @@ -67,7 +67,7 @@ def daily_checkin() -> bool:
return do_daily_checkin_(verify_code=code, form_hash=form_hash, sec_hash=sec_hash)


def daily_question() -> bool:
def daily_question(api_key: str) -> bool:
print("do daily question...")
answer, form_hash, sec_hash, = get_daily_task_answer()
time.sleep(2)
Expand All @@ -79,25 +79,32 @@ def daily_question() -> bool:
return do_daily_question_(answer=answer, verify_code=code, form_hash=form_hash, sec_hash=sec_hash)


def do_all(username: str, password: str):
def do_all(username: str, password: str, api_key: str):
print(f"for user: {username[:3]}...{username[-2:]}")
daily_login(username, password)
daily_checkin()
daily_question()
daily_checkin(api_key)
daily_question(api_key)
return


def main(from_file: bool = False):
users = []
api_key = ""
if from_file or len(sys.argv) == 1:
fp = open("../configure/data.json")
users = json.load(fp)
data = json.load(fp)
users = data["users"]
api_key = data["api_key"]
else:
users = json.loads(sys.argv[1].replace("'", '"'))
api_key = sys.argv[1]
users = json.loads(sys.argv[2].replace("'", '"'))
print(users)
print(api_key)
exit(0)
for user in users:
m = hashlib.md5()
m.update(user["password"].encode("ascii"))
do_all(user["username"], m.hexdigest())
do_all(user["username"], m.hexdigest(), api_key)


if __name__ == "__main__":
Expand Down

0 comments on commit acb280e

Please sign in to comment.