├── README.md └── hackbot.py /README.md: -------------------------------------------------------------------------------- 1 | # About HackBot - (No longer maintained) 2 | A simple hackingbot for terminal usage (Able to learn and adapt from users). 3 | This is based off from the langauge model Mistral AI that intergrates its API requests from Unofficial WormGPT. 4 | 5 | I created this for bug hunters and security researchers although anyone can use it really. 6 | 7 | # Usage: 8 | python3 hackbot.py 9 | 10 | (It will also create a friendship_history.json dump file to store and load the conversation for memory of the user, you can delete this file manually, it'll be created again after usage) 11 | -------------------------------------------------------------------------------- /hackbot.py: -------------------------------------------------------------------------------- 1 | #madebyshiv 2 | import os 3 | import re 4 | import requests 5 | import json 6 | import random 7 | import readline 8 | 9 | # ANSI color codes 10 | LIGHT_BLUE = '\033[94m' 11 | RED = '\033[91m' 12 | ENDC = '\033[0m' 13 | 14 | def interact_with_wormgpt(user_input, friendship_history): 15 | try: 16 | headers = { 17 | 'x-wormgpt-provider': 'worm_gpt', 18 | 'Content-Type': 'application/json', 19 | } 20 | 21 | json_data = { 22 | 'messages': friendship_history + [{'role': 'user', 'content': user_input}], 23 | 'max_tokens': 820, 24 | } 25 | 26 | response = requests.post('https://wrmgpt.com/v1/chat/completions', headers=headers, json=json_data) 27 | ai_response = response.json()['choices'][0]['message']['content'] 28 | 29 | # Remove specified words from the response 30 | excluded_words = ["[INST]", "[/s>[INSt]", "[s>[INST]", "[INSt]", "[/s>", "", "[/>", "[s>", "[s>[INST>", "[INTRODUCTION]", "[", "INST>"] 31 | for word in excluded_words: 32 | ai_response = re.sub(re.escape(word), "", ai_response) 33 | 34 | return ai_response.strip() # Strip any leading or trailing whitespaces 35 | except Exception as e: 36 | print("HackerBot: Soz, I couldn't process your request. Maybe the API is down. Please try again later.") 37 | return "" 38 | 39 | def is_gibberish(input_text): 40 | # Define patterns to match gibberish 41 | gibberish_patterns = [ 42 | r'^([a-zA-Z])\1+$', 43 | r'^[a-zA-Z]*([a-zA-Z])\1{2,}[a-zA-Z]*$', 44 | r'^[a-zA-Z]*[^a-zA-Z\s]{2,}[a-zA-Z]*$', 45 | r'^\s*$', 46 | ] 47 | 48 | # Check if the input matches any gibberish pattern 49 | for pattern in gibberish_patterns: 50 | if re.match(pattern, input_text): 51 | return True 52 | 53 | return False 54 | 55 | def save_friendship_history(friendship_history, filename="friendship_history.json"): 56 | with open(filename, 'w') as file: 57 | json.dump(friendship_history, file) 58 | 59 | def load_friendship_history(filename="friendship_history.json"): 60 | if os.path.exists(filename): 61 | with open(filename, 'r') as file: 62 | return json.load(file) 63 | else: 64 | return [] 65 | 66 | def main(): 67 | print(f"{LIGHT_BLUE}HackerBot:{ENDC} Hello Friend") 68 | 69 | gratitude_responses = [ 70 | "No problem!", 71 | "Much Luvs ;).", 72 | "Anytime!", 73 | "Happy to assist!", 74 | "You got it from here. I believe in you.", 75 | "Let's gooooo :)" 76 | ] 77 | 78 | friendship_history = load_friendship_history() 79 | last_user_input = None 80 | 81 | while True: 82 | try: 83 | user_input = input(f"{RED}You:{ENDC} ").strip() # Use input function 84 | 85 | if not user_input: 86 | continue 87 | 88 | if user_input.lower() in ['quit', 'exit', 'bye', 'goodbye', 'goodnight', 'cya']: 89 | print(f"{LIGHT_BLUE}Goodbye Friend...{ENDC}") 90 | save_friendship_history(friendship_history) 91 | break 92 | 93 | if is_gibberish(user_input): 94 | print(f"{LIGHT_BLUE}HackerBot:{ENDC} Please provide more info ;(") 95 | continue 96 | 97 | if user_input.lower() == 'show history': 98 | for message in friendship_history: 99 | print(message['role'] + ": " + message['content']) 100 | continue 101 | 102 | if user_input.lower() == last_user_input: 103 | print(f"{LIGHT_BLUE}HackerBot:{ENDC} Stop being annoying.") 104 | continue 105 | 106 | gratitude_words = ['thanks', 'thank you', 'nice', 'ok', 'nice, thanks a lot', 'appreciate it', 'grateful', 'much obliged', 'cool'] 107 | if any(word in user_input.lower() for word in gratitude_words): 108 | print(f"{LIGHT_BLUE}HackerBot:{ENDC}", random.choice(gratitude_responses)) 109 | continue 110 | 111 | response = interact_with_wormgpt(user_input, friendship_history) 112 | 113 | friendship_history.append({'role': 'user', 'content': user_input}) 114 | if response.lower() != user_input.lower(): 115 | friendship_history.append({'role': 'model', 'content': response}) 116 | 117 | last_user_input = user_input 118 | except KeyboardInterrupt: 119 | print(f"\n{LIGHT_BLUE}HackerBot:{ENDC} Goodbye! Exiting...") 120 | save_friendship_history(friendship_history) 121 | break 122 | 123 | if __name__ == "__main__": 124 | main() 125 | --------------------------------------------------------------------------------