-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintai.py
145 lines (130 loc) · 7.36 KB
/
intai.py
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import requests
from bs4 import BeautifulSoup
import random
def fetch_page_content(url):
try:
response = requests.get(url)
if response.status_code == 200:
return response.text
except requests.RequestException as e:
print(f"Error fetching {url}: {e}")
return None
def extract_relevant_info(error_message, content):
if error_message.lower() in content.lower():
return True
return False
def analyze_error(error_message):
urls = [
"https://github.com/intSpLoiT/intframework",
"https://github.com/intSpLoiT/intframework/issues",
"https://github.com/intSpLoiT/int-formations",
"https://github.com/intSpLoiT/int-formations/issues",
"https://github.com/intSpLoiT/intframework-termux",
"https://github.com/intSpLoiT/intframework-termux/issues",
"https://github.com/nmap/nmap",
"https://github.com/nmap/nmap/issues",
"https://www.metasploit.com/",
"https://rapid7.github.io/metasploit-framework/docs/using-metasploit/getting-started/nightly-installers.html",
"https://www.kali.org/",
"https://www.kali.org/tools/",
"https://www.google.com/"
]
for url in urls:
content = fetch_page_content(url)
if content and extract_relevant_info(error_message, content):
return (f"A relevant section found in {url}. Please check it for more info.",
f"İlgili bir bölüm {url} adresinde bulundu. Daha fazla bilgi için kontrol edin.")
return suggest_solution(error_message)
def suggest_solution(error_message):
solutions_en = {
"module not found": "Ensure the module is installed using pip.",
"permission denied": "Check file permissions and ensure you have the necessary access rights.",
"syntax error": "Check the syntax in your code for any mistakes.",
"timeout error": "Increase the timeout limit or check your internet connection.",
"connection refused": "Check if the server is running and reachable."
}
solutions_tr = {
"module not found": "Modülün pip ile yüklü olduğundan emin olun.",
"permission denied": "Dosya izinlerini kontrol edin ve gerekli erişim haklarına sahip olduğunuzdan emin olun.",
"syntax error": "Kodunuzdaki sözdizimini kontrol edin ve hataları düzeltin.",
"timeout error": "Zaman aşımı limitini artırın veya internet bağlantınızı kontrol edin.",
"connection refused": "Sunucunun çalışır durumda ve erişilebilir olduğundan emin olun."
}
for key in solutions_en:
if key in error_message.lower():
return solutions_en[key], solutions_tr[key]
default_responses_en = [
"No solution found. Please check the error message or visit the provided links.",
"Couldn't find an exact solution. Try searching the provided links for more help.",
"The error isn't directly addressed in the resources. Please double-check the links for more info."
]
default_responses_tr = [
"Çözüm bulunamadı. Lütfen hata mesajını kontrol edin veya verilen linkleri ziyaret edin.",
"Tam olarak bir çözüm bulunamadı. Daha fazla yardım için verilen linkleri kontrol edin.",
"Hata doğrudan kaynaklarda ele alınmamış. Daha fazla bilgi için linkleri kontrol edin."
]
return random.choice(default_responses_en), random.choice(default_responses_tr)
def get_installation_info():
messages_en = [
"For installation, on Kali Linux, install necessary dependencies and clone the repository using 'git clone'.",
"On Termux, install required packages and clone the repository using 'git clone'.",
"Ensure all dependencies are installed correctly before using 'git clone' to complete the installation."
]
messages_tr = [
"Kurulum için Kali Linux'ta gerekli bağımlılıkları yükleyin ve 'git clone' komutuyla intframework'ü indirin.",
"Termux üzerinde gerekli paketleri yükledikten sonra 'git clone' komutunu kullanarak intframework'ü indirin.",
"Bağımlılıkların eksiksiz kurulduğundan emin olduktan sonra 'git clone' komutunu kullanarak kurulumu tamamlayın."
]
return random.choice(messages_en), random.choice(messages_tr)
def get_error_info():
messages_en = [
"During installation, ensure all dependencies are fully installed.",
"For runtime errors, check file permissions and grant necessary permissions.",
"Ensure correct versions of dependencies are used and update if necessary."
]
messages_tr = [
"Kurulum sırasında bağımlılıkların tam olarak yüklendiğinden emin olun.",
"Çalıştırma hatalarında dosya izinlerini kontrol edin ve gerekli yetkileri verin.",
"Bağımlılıkların doğru sürümlerini kullandığınızdan emin olun ve gerekirse güncelleyin."
]
return random.choice(messages_en), random.choice(messages_tr)
def get_usage_info():
messages_en = [
"To start the tool, use the command 'python3 intconsole'.",
"For usage, first configure necessary settings, then run the tool with 'python3 intconsole'.",
"Run the tool from the command line by typing 'python3 intconsole'."
]
messages_tr = [
"Aracı başlatmak için 'python3 intconsole' komutunu kullanın.",
"Kullanım için önce gerekli konfigürasyonları yapın, ardından 'python3 intconsole' ile aracı çalıştırın.",
"Komut satırından 'python3 intconsole' yazarak aracı çalıştırabilirsiniz."
]
return random.choice(messages_en), random.choice(messages_tr)
def provide_info(query, language):
if "kurulum" in query or "install" in query:
return get_installation_info()[0 if language == 'en' else 1]
elif "hata" in query or "error" in query:
error_message = input("Please enter the error message / Lütfen aldığınız hata mesajını girin: ").strip()
return analyze_error(error_message)[0 if language == 'en' else 1]
elif "kullanım" in query or "usage" in query:
return get_usage_info()[0 if language == 'en' else 1]
elif "araştırma" in query or "research" in query:
research_topic = input("What topic would you like to research? / Hangi konuda araştırma yapmak istiyorsunuz?: ").strip()
search_url = f"https://www.google.com/search?q={research_topic.replace(' ', '+')}"
return (f"You can start your research here: {search_url}",
f"Araştırmanıza buradan başlayabilirsiniz: {search_url}")
else:
return ("I can help with installation, error troubleshooting, usage, or research. Please ask a more specific question.",
"Kurulum, hata giderme, kullanım veya araştırma konularında yardımcı olabilirim. Lütfen daha spesifik bir soru sorun.")[0 if language == 'en' else 1]
def main():
print("Merhaba ben intai'yim! / Hello, I am intai!")
language = input("Please choose a language (en/tr): ").strip().lower()
while True:
user_input = input("\nWhat do you need help with? (type 'exit' to quit) / Ne konuda yardıma ihtiyacınız var? (çıkmak için 'exit' yazın): ").strip().lower()
if user_input == 'exit':
break
if user_input: # Sadece kullanıcı bir şey yazdığında yanıt ver
response = provide_info(user_input, language)
print(response)
if __name__ == "__main__":
main()