Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Recommended to use an obfuscator in case of using it
- import requests
- import time
- def main(): # inside here should go the main code of the program
- print('\nWhitelisted.')
- resp = requests.get('http://ip-api.com/json/').json() # here we make a get request to the ip-api.com page to obtain the user's ip
- ip = resp['query'] # here we save the user's ip in the ip variable
- whitelist_ip = [ # Our list that we will use to put the IPs inside
- "185.8.63.38", # Here inside will be the IP of the people who will be able to execute the main function (main)
- "169.254.0.1",
- ]
- if ip in whitelist_ip: # Here we check if the ip of the variable is in our list
- print(f'Verifying IP: {ip}')
- time.sleep(3)
- print('Verified IP.')
- time.sleep(2)
- menu() # Here we execute the main function verifying that the user's IP is in the whitelisted IP list
- else:
- print(f'Verifying IP: {ip}')
- time.sleep(3)
- print('You are not on the white list!')
- exit() # Here we make an output by verifying that the user's IP is not in our list of whitelisted IPs
Advertisement
Add Comment
Please, Sign In to add comment