feat: Initial code drop

This commit is contained in:
Nathan Woodburn 2023-12-27 20:37:11 +11:00
parent 9aafbb4dfc
commit 804221b851
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
4 changed files with 84 additions and 0 deletions

View File

@ -1 +1,25 @@
# bidbot # bidbot
Install dependencies:
```
python3 -m pip install -r requirements.txt
```
Copy `config.json.example` to `config.json` and fill in the values.
Run:
```
python3 main.py config.json
```
Config format:
```json
{
"namebaseToken": "s%A.....", // Namebase-main cookie
"bid": 10, // Bid amount in HNS
"blind": 10, // Blind amount (eg. bid of 10 + blind of 10 = lockup of 20)
"prefix": "superlongdomain", // Prefix of domain to bid on (don't use anything already registered or you could create errors)
"count": 100, // Number of domains to bid on
"start": 0 // Starting index of domains to bid on (use this to resume from a previous run)
}
```

8
config.json.example Normal file
View File

@ -0,0 +1,8 @@
{
"namebaseToken": "s%A.....",
"bid": "5.000000",
"blind": "5.000000",
"prefix": "testbotbids",
"count": 100,
"start": 0
}

51
main.py Normal file
View File

@ -0,0 +1,51 @@
import requests
import json
import sys
import os
# Get arguments from command line and store them in a list
args = sys.argv[1:]
configFile = 'config.json'
if len(args) == 0:
print("Using default config file: config.json")
else:
configFile = args[0]
if not os.path.isfile(configFile):
print("Config file not found")
exit()
# Open config file and load it into a dictionary
with open(configFile) as json_file:
config = json.load(json_file)
cookies = {
'namebase-main': config['namebaseToken']
}
headers = {'Content-Type': 'application/json'}
data = {
'bidAmount': config['bid'],
'blindAmount': config['blind']
}
# Loop for count domains
start = config['start']
number = config['count']
# Create list of domains using prefix and number
padding = len(str(number))
print(data)
for i in range(number):
domain = config['prefix'] + str(i).zfill(padding)
print("Bidding on: " + domain)
response = requests.post('https://www.namebase.io/api/v0/auction/' + domain + '/bid', cookies=cookies,headers=headers, json=data)
print(response.text)
if response.status_code != 200:
print("Error bidding on: " + domain)
print(response.text)
exit()

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
requests