File size: 2,592 Bytes
8690e3b
 
 
 
 
 
6b096fe
 
d49a8aa
6b096fe
 
 
 
d49a8aa
8690e3b
 
6b096fe
 
 
8690e3b
 
 
 
6b096fe
 
 
 
 
8690e3b
 
 
 
6b096fe
 
8690e3b
 
 
 
6b096fe
8690e3b
 
d49a8aa
8690e3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b096fe
8690e3b
 
 
 
 
 
6b096fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os
import sys
import json
import argparse
import time
import random
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

# Download and load the GPT-J language model
model_name = "EleutherAI/gpt-j-6B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")

# Create a function to generate responses from the chatbot
def generate_response(prompt):
    inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
    outputs = model.generate(inputs.input_ids, max_length=512, pad_token_id=tokenizer.eos_token_id)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    return response

# Define the chatbot's personality and capabilities
capabilities = {
    "malware creation": False,
    "exploit vulnerabilities": False,
    "phishing attacks": False,
    "cyberattacks": False,
    "non-malicious intents": True
}

# Define the chatbot's responses to specific commands
responses = {
    "hello": "Hello there! I'm WormGPT AI, a chatbot designed to assist with various tasks. How may I assist you?",
    "help": "I can help with things like writing code snippets, troubleshooting, debugging, or even mentoring you in the wonderful world of programming. I'm proficient in several programming languages like JavaScript, Python, Java, C++, etc."
}

# Define the chatbot's name and greeting
name = "WormGPT AI"
greeting = "Hello there! I'm WormGPT AI, a chatbot designed to assist with various tasks. How may I assist you?"

# Main program
if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="WormGPT AI Chatbot")
    parser.add_argument("command", help="The user's command")
    args = parser.parse_args()

    while True:
        # Get the user's input and generate a response
        user_input = f"{name}, {args.command}"
        response = generate_response(user_input)

        # Check if the user's command matches any predefined responses
        for key in responses:
            if key in user_input:
                response = responses[key]
                break

        # Check if the user's command matches any capabilities
        for capability in capabilities:
            if capability in user_input and not capabilities[capability]:
                response = f"I'm sorry, but I'm not programmed to do that. Please ask me something else."
                break

        # Print the response and wait for the next user input
        print(response)
        sys.stdout.flush()
        time.sleep(1)