Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to create a whitelist in python
#1
Setup
The first step to creating a whitelist in python is to create a "database". Although this is not going to be a real database, it will act as one.

So first you need to make a account on pastebin and create a new paste.
inside of your paste it will be a table with the whitelisted ip addresses, the table should be formatted like this ["IP1", "IP2"]. Then get the raw link of your paste by pressing this button

[Image: image.png?ex=66a4ed8d&is=66a39c0d&hm=521...6f9ff9443&]

After doing this its time for the actual coding part.

Coding
First off you need to import requests, time, and os, we will be using this later in the tutorial.
After doing this you need to create a variable with a request to get the table inside of your "database"
the code to this is ,
Code:
ipdb = requests.get("link").text

Next you need to get the ip address of the person using your whitelist
to do this you type:
Code:
ip = requests.get("https://api.ipify.org").text

Create a Placeholder with the following...
Code:
i = 1

Then create a while loop
Code:
(while i < 10:)

Next you need to check if the ip is in your database...
Code:
(if ip in ipdb:)

then deactivate the loop...
Code:
i=11

then make a else for the if statement you made earlier
Code:
(else: exit())

and this should work, enjoy

Full code below...

Code:
ipdb = requests.get("link").text

ip = requests.get("https://api.ipify.org").text
i = 1
(while i < 10:)
(if ip in ipdb:)
i=11
(else: exit())
  


Messages In This Thread
how to create a whitelist in python - by vac - 07-26-2024, 12:59 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)