Skip to content

Instantly share code, notes, and snippets.

@Th3redTea
Last active July 26, 2021 14:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Th3redTea/1e60193abf45ae962105053266c6590a to your computer and use it in GitHub Desktop.
Save Th3redTea/1e60193abf45ae962105053266c6590a to your computer and use it in GitHub Desktop.
The fetchor takes any file and fetch for valuable content including IP addresses, JWT, subdomains, and email IDs. This gist was created execlusivly for the PyForGood Tutorial.
#!/usr/bin/python3
import re
def findStuff():
file = open('js.js', 'r') #we open a local file
Text = file.read() #Give the content of the file to the variable Text
#Create a RegEx to look for ip addresses. The findall will look for any string that meets the given pattent in the Text
#Same goes for Emails and other stuff
IP = re.findall(r'(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})', Text)
Email = re.findall(r'([\w\.-]+@+[\w\.-]+\.+[\w]{1,5})', Text)
subs = re.findall(r'[a-z0-9\.-]+\.+[a-z0-9.-]+\.+[a-z]{1,5}', Text) #the findall will return an empty list if there's no match.
JWT = re.findall(r'(ey+[\w]+\.[\w]+\.[\w]*)', Text)
#Usually the findall function returns result in a list.
#So we use the for loop to print the result as a simple string.
for i in IP:
#for item in the array IP, print the following...
print("Found an IP: " + str(i))
for e in Email:
print("Found emails: "+ str(e))
for s in subs:
print("Found subdoamin: " + str(s))
for j in JWT:
print("Found some JWT Tokens: "+ str(j))
file.close() # close the file
findStuff()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment