327
Підписники
Немає даних24 години
Немає даних7 днів
Немає даних30 днів
- Підписники
- Перегляди допису
- ER - коефіцієнт залучення
Триває завантаження даних...
Приріст підписників
Триває завантаження даних...
import re
bot_template = "BOT : {0}"
user_template = "USER : {0}"
# Define a function that sends a message to the bot: send_message
def send_message(message):
# Print user_template including the user_message
print(user_template.format(message))
# Get the bot's response to the message
response = respond(message)
# Print the bot template including the bot's response.
print(bot_template.format(response))
# Define a function that sends a message to the bot: respond
def respond(message):
# Concatenate the user's message to the end of a standard bot respone
bot_message = "I can hear you! You said: " + message
return bot_message
# Define match_rule()
def match_rule(rules, message):
response, phrase = "default", None
# Iterate over the rules dictionary
for pattern, responses in rules.items():
# Create a match object
match = re.search(pattern, message)
if match is not None:
# Choose a random response
response = random.choice(responses)
if '{0}' in response:
phrase = match.group(1)
# Return the response and phrase
return response, phrase
# Test match_rule
print(match_rule(rules, "do you remember your last birthday"))
# Define replace_pronouns()
def replace_pronouns(message):
message = message.lower()
if 'me' in message:
# Replace 'me' with 'you'
return re.sub('me', 'you', message)
if 'my' in message:
# Replace 'my' with 'your'
return re.sub('my', 'your', message)
if 'your' in message:
# Replace 'your' with 'my'
return re.sub('your', 'my', message)
if 'you' in message:
# Replace 'you' with 'me'
return re.sub('you', 'me', message)
return message
# Test replace_pronouns
print(replace_pronouns("my last birthday"))
print(replace_pronouns("when you went to Florida"))
print(replace_pronouns("I had my own castle"))
# Define respond()
def respond(message):
# Call match_rule
response, phrase = match_rule(rules, message)
if '{0}' in response:
# Replace the pronouns in the phrase
phrase = replace_pronouns(phrase)
# Include the phrase in the response
response = response.format(phrase)
return response
# Send the messages
send_message("do you remember your last birthday")
send_message("do you think humans should be worried about AI")
send_message("I want a robot friend")
send_message("what if you could be anything you wanted")
import socket
def scan_ports(host, start_port, end_port):
open_ports = []
for port in range(start_port, end_port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(0.5)
result = sock.connect_ex((host, port))
if result == 0:
open_ports.append(port)
sock.close()
return open_ports
if name == "main":
host = input("Enter host IP: ")
start_port = int(input("Enter start port: "))
end_port = int(input("Enter end port: "))
open_ports = scan_ports(host, start_port, end_port)
if len(open_ports) > 0:
print("Open ports:", open_ports)
else:
print("No open ports found.")
Everything that is imperfect has gaps. mark this date 12-12-2022
#Crash_4.0
Показати все...
GitHub - Sharpforce/XSS-Exploitation-Tool: An XSS Exploitation Tool
An XSS Exploitation Tool. Contribute to Sharpforce/XSS-Exploitation-Tool development by creating an account on GitHub.