From 804221b851b420a266c68b4cf90c8d30e06e8ed8 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Wed, 27 Dec 2023 20:37:11 +1100 Subject: [PATCH] feat: Initial code drop --- README.md | 24 +++++++++++++++++++++ config.json.example | 8 +++++++ main.py | 51 +++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + 4 files changed, 84 insertions(+) create mode 100644 config.json.example create mode 100644 main.py create mode 100644 requirements.txt diff --git a/README.md b/README.md index 372863f..d59022e 100644 --- a/README.md +++ b/README.md @@ -1 +1,25 @@ # 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) +} +``` \ No newline at end of file diff --git a/config.json.example b/config.json.example new file mode 100644 index 0000000..8221a96 --- /dev/null +++ b/config.json.example @@ -0,0 +1,8 @@ +{ + "namebaseToken": "s%A.....", + "bid": "5.000000", + "blind": "5.000000", + "prefix": "testbotbids", + "count": 100, + "start": 0 +} \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..fcda620 --- /dev/null +++ b/main.py @@ -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() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..663bd1f --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +requests \ No newline at end of file