-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snusbase API not working #166
Comments
The URL in the run.py is out of date, furthermore, the request method in the classes.py is also misconfigured (mainly in the update headers line). I am currently playing around with the code to see if I can get it to work. Further infor on the api documentation can be found here: https://docs.snusbase.com/#42-python. EDIT: Never got it working, instead I created my own Python script that may be integratable with h8mail's codebase? #!/usr/bin/python3
import argparse
import os
import json
import datetime
import requests
import fade
from colorama import Fore, Style
from urllib.request import Request, urlopen
user = os.getlogin()
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')
def create_directory(category):
directory = f"/home/{user}/snus-email-tool/{category}"
if not os.path.exists(directory):
os.makedirs(directory)
return directory
def save_error_log(error):
now = datetime.datetime.now()
timestamp = now.strftime("%Y-%m-%d_%H-%M-%S")
log_directory = create_directory("logs")
log_file = os.path.join(log_directory, f"error_{timestamp}.log")
with open(log_file, "w") as file:
file.write(str(error))
snusbase_auth = 'sbuncd7b2bfcflweh3dkbeqsuzlzqk'
snusbase_api = 'https://api-experimental.snusbase.com/'
def api_email():
clear_screen()
text_default_fade = fade.greenblue(text_default)
print(text_default_fade)
def send_request(url, body=None):
headers = {
'Auth': snusbase_auth,
'Content-Type': 'application/json',
}
method = 'POST' if body else 'GET'
data = json.dumps(body) if body else None
response = requests.request(method, snusbase_api + url, headers=headers, data=data)
return response.json()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-F', '--filename', type=str)
args = parser.parse_args()
filename = args.filename
f = open(filename, 'r')
for line in f:
result = line.split()
search_response = send_request('data/search', {
'terms': result,
'types': ["email"],
'wildcard': False,
})
formatted_response = json.dumps(search_response, indent=2)
print(formatted_response)
output_directory = create_directory("output")
output_file = os.path.join(output_directory, f"{result}.json")
user_path = os.path.join(f"{output_file}")
Results_default = f"Results have been saved to: {user_path}"
Results_default_fade = fade.purpleblue(Results_default)
print("\n")
print (Results_default_fade)
with open(output_file, "w") as outfile:
outfile.write(formatted_response)
text_default ='''
DMMMMMMD
MMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMM.
MMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMM
.MMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MM+ MMMMMMMMMMMMMMMMMMMM$ MM
+M. ZMMMMMMMMMMMMMMO M
MM MMMMMMMMMM MM
MMD MMMM. .MM
MMMMMM MMM=MMI DMMMMM
MMMMMMMMMMM +MMMMMMMMMMM
MMMMMMMMMMM 8M MMMMMMMMMMMD
MMMMM MMM.MM MMMM MMM
MMM7 MMMMMMMMMMM M8
MM MM M MMM
MM MM,M MM
MM.MM=M MM
MM~MM+M MM
8M~MM+M MM
,M~MMIM MM
M:MMZM MM
M.MMIM MM
Authors: Alegra
'''
api_email() |
in run.py
in classes.py
this should help |
Hi,
I've been trying h8mail and i've noticed that Snusbase API not working.
I've try :
h8mail -t [email protected] -k "snusbase_url=https://api-experimental.snusbase.com/data/search" "snusbase_token=xxxxxxxxxxxxxxxxxxxxxxxx" --debug
The response :
If I try directly with :
curl --request POST --url https://api-experimental.snusbase.com/data/search --header "Auth: xxxxxxxxxxxxxxxxxxxxxxxxxxxx" --header "Content-Type: application/json" --data '{"terms":["[email protected]"], "types":["email"], "wildcard": false}'
It works.
The text was updated successfully, but these errors were encountered: