Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import osint_library
- import tweepy
- import requests
- import sys
- def search_username(username, include_twitter=False, include_public_records=False, verbose=False):
- try:
- osint_data = osint_library.search(username)
- additional_data = {}
- if include_twitter:
- additional_data["twitter_data"] = get_twitter_data(username)
- if include_public_records:
- additional_data["public_records_data"] = get_public_records_data(username)
- combined_data = {**osint_data, **additional_data}
- if verbose:
- print(f"\n=== Detailed Information for {username} ===")
- print(combined_data)
- return combined_data
- except Exception as e:
- return {"error": f"Error occurred during GhostDox search: {e}"}
- def get_twitter_data(username):
- try:
- consumer_key = 'your_consumer_key'
- consumer_secret = 'your_consumer_secret'
- access_token = 'your_access_token'
- access_token_secret = 'your_access_token_secret'
- auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
- auth.set_access_token(access_token, access_token_secret)
- api = tweepy.API(auth)
- user_data = api.get_user(screen_name=username)._json
- return {"twitter_data": user_data}
- except tweepy.TweepError as te:
- return {"twitter_error": f"Error fetching Twitter data: {te}"}
- def get_public_records_data(username):
- try:
- api_url = 'your_public_records_api_url'
- response = requests.get(api_url, params={'username': username})
- if response.status_code == 200:
- return response.json()
- else:
- raise Exception(f"Failed to fetch public records data. Status code: {response.status_code}")
- except Exception as e:
- return {"public_records_error": f"Error fetching public records data: {e}"}
- def parse_data(data):
- parsed_info = {
- "name": data.get("name", ""),
- "email": data.get("email", ""),
- "location": data.get("location", ""),
- "twitter_followers": data.get("twitter_data", {}).get("followers_count", 0),
- # Add more fields to parse as needed
- }
- return parsed_info
- def display_parsed_info(parsed_info):
- print("Parsed information:")
- for key, value in parsed_info.items():
- print(f"{key}: {value}")
- def get_user_input():
- usernames = input("Enter one or more usernames (comma-separated): ").split(',')
- return [username.strip() for username in usernames]
- def show_help():
- print("=== GhostDox OSINT User Search Tool ===")
- print("This tool searches for a username using OSINT and optional social media and public records APIs.")
- print("Usage: python GhostDox.py [OPTIONS]")
- print("\nOptions:")
- print(" -h, --help Display this help message")
- print(" -u, --usernames Specify one or more usernames (comma-separated)")
- print(" -t, --include-twitter Include Twitter data in the GhostDox search")
- print(" -p, --include-public-records Include public records data in the GhostDox search")
- print(" -v, --verbose Print detailed information")
- print("\nExamples:")
- print(" python GhostDox.py -u user1,user2 -t -p")
- print(" python GhostDox.py --usernames user3 -p -v")
- print(" python GhostDox.py -h")
- def main():
- try:
- if "-h" in sys.argv or "--help" in sys.argv:
- show_help()
- return
- include_twitter = "-t" in sys.argv or "--include-twitter" in sys.argv
- include_public_records = "-p" in sys.argv or "--include-public-records" in sys.argv
- verbose = "-v" in sys.argv or "--verbose" in sys.argv
- usernames = get_user_input() if "-u" not in sys.argv and "--usernames" not in sys.argv else sys.argv[sys.argv.index("-u") + 1].split(',')
- for username in usernames:
- search_results = search_username(username, include_twitter, include_public_records, verbose)
- if "error" in search_results:
- print(search_results["error"])
- elif "twitter_error" in search_results:
- print(search_results["twitter_error"])
- elif "public_records_error" in search_results:
- print(search_results["public_records_error"])
- else:
- parsed_info = parse_data(search_results)
- display_parsed_info(parsed_info)
- except Exception as e:
- print(f"An unexpected error occurred: {e}")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement