Jhosein
Kayıtlı Üye
- Katılım
- 12 Ekim 2024
- Mesajlar
- 63
- Tepkime puanı
- 2
- Konum
- Azerbeycan
- İlgi Alanlarınız
- Windows Tweak
- Cinsiyet
-
- Erkek
Merhaba, bu işte yeni olduğum için çok hatalarım ola bilir. Size yazdığım Python toolu paylaşıyorum. Ne gibi hatalar var, ne gibi düzelişler etmeliyim yardım ederseniz ortaya iyi bir sonuç çıkara biliriz. Kendinizde değişiklik yaparak bizimle paylaşa bilirsiniz, herkesin yararlanması için.
import phonenumbers
from phonenumbers import geocoder, carrier, timezone
import requests
from twilio.rest import Client
from shodan import Shodan
from folium import Map, Marker
from textblob import TextBlob
from ipwhois import IPWhois
import os
class PhoneTool:
def __init__(self, shodan_key, twilio_sid, twilio_token, numverify_key):
self.shodan_key = shodan_key
self.twilio_sid = twilio_sid
self.twilio_token = twilio_token
self.numverify_key = numverify_key
def verify_phone(self, phone_number):
try:
# Numverify API kullanarak doğrulama
url = f"http://apilayer.net/api/validate?access_key={self.numverify_key}&number={phone_number}&country_code=TR&format=1"
response = requests.get(url)
return response.json()
except Exception as e:
return {"error": str(e)}
def shodan_search(self, phone_number):
try:
api = Shodan(self.shodan_key)
return api.search(phone_number)
except Exception as e:
return {"error": str(e)}
def send_sms(self, phone_number, message):
try:
client = Client(self.twilio_sid, self.twilio_token)
message = client.messages.create(
to=phone_number,
from_="+123456789", # Twilio numaranız ile değiştirin
body=message
)
return message.sid
except Exception as e:
return {"error": str(e)}
def generate_map(self, location):
try:
map_location = Map(location=location, zoom_start=10)
Marker(location).add_to(map_location)
map_location.save("location_map.html")
return "Harita HTML dosyası oluşturuldu: location_map.html"
except Exception as e:
return {"error": str(e)}
def analyze_text(self, text):
try:
blob = TextBlob(text)
return {
'polarity': blob.sentiment.polarity,
'subjectivity': blob.sentiment.subjectivity
}
except Exception as e:
return {"error": str(e)}
def get_weather(self, location):
try:
response = requests.get(f"http://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q={location}")
return response.json()
except Exception as e:
return {"error": str(e)}
def ip_lookup(self, ip_address):
try:
ip_info = IPWhois(ip_address)
return ip_info.lookup_rdap()
except Exception as e:
return {"error": str(e)}
def main():
phone_tool = PhoneTool(
os.getenv("SHODAN_API_KEY"),
os.getenv("TWILIO_ACCOUNT_SID"),
os.getenv("TWILIO_AUTH_TOKEN"),
os.getenv("NUMVERIFY_API_KEY")
)
phone_number = input("Telefon numaranızı girin (+90 xxx xxx xx xx): ")
verify_result = phone_tool.verify_phone(phone_number)
if not verify_result.get('valid'):
print("Numara geçerli değil.")
return
# Sonuçları sütun halinde göster
print(f"\n{'-'*50}")
print(f"Telefon Numarası: {phone_number}")
print(f"Bölge: {geocoder.description_for_number(phonenumbers.parse(phone_number, 'TR'), 'tr')}")
print(f"Operatör: {carrier.name_for_number(phonenumbers.parse(phone_number, 'TR'), 'tr')}")
print(f"Zaman Dilimi: {timezone.time_zones_for_number(phonenumbers.parse(phone_number, 'TR'))}")
print(f"{'-'*50}\n")
# Shodan sonuçları
print("Shodan sonuçları:")
shodan_results = phone_tool.shodan_search(phone_number)
for result in shodan_results['matches']:
print(f"IP: {result['ip_str']}, Port: {result['port']}")
print(f"{'-'*50}\n")
# SMS gönderme
sms_content = "Test mesajı: Bu mesaj numaranıza gönderildi."
send_sms_result = phone_tool.send_sms(phone_number, sms_content)
print(f"SMS gönderildi: {send_sms_result}")
print(f"{'-'*50}\n")
# Harita oluşturma
location = [41.0082, 28.9784] # İstanbul koordinatları
map_result = phone_tool.generate_map(location)
print(map_result)
print(f"{'-'*50}\n")
# Metin analizi
text = input("Analiz için metin girin: ")
analysis_result = phone_tool.analyze_text(text)
print(f"Metin Analizi:")
print(f"Polarity (Olumluluk): {analysis_result['polarity']}")
print(f"Subjectivity (Öznelik): {analysis_result['subjectivity']}")
print(f"{'-'*50}\n")
# Hava durumu bilgisi
weather_location = input("Hava durumu bilgisi için bir yer girin: ")
weather_result = phone_tool.get_weather(weather_location)
print(f"Hava Durumu:")
print(f"Yer: {weather_result['location']['name']}, Sıcaklık: {weather_result['current']['temp_c']}°C")
print(f"{'-'*50}\n")
# IP adresi araması
ip_address = input("IP adresi girin (sorgulama için): ")
ip_info = phone_tool.ip_lookup(ip_address)
print(f"IP Bilgisi:")
print(ip_info)
print(f"{'-'*50}\n")
if __name__ == "__main__":
main()
import phonenumbers
from phonenumbers import geocoder, carrier, timezone
import requests
from twilio.rest import Client
from shodan import Shodan
from folium import Map, Marker
from textblob import TextBlob
from ipwhois import IPWhois
import os
class PhoneTool:
def __init__(self, shodan_key, twilio_sid, twilio_token, numverify_key):
self.shodan_key = shodan_key
self.twilio_sid = twilio_sid
self.twilio_token = twilio_token
self.numverify_key = numverify_key
def verify_phone(self, phone_number):
try:
# Numverify API kullanarak doğrulama
url = f"http://apilayer.net/api/validate?access_key={self.numverify_key}&number={phone_number}&country_code=TR&format=1"
response = requests.get(url)
return response.json()
except Exception as e:
return {"error": str(e)}
def shodan_search(self, phone_number):
try:
api = Shodan(self.shodan_key)
return api.search(phone_number)
except Exception as e:
return {"error": str(e)}
def send_sms(self, phone_number, message):
try:
client = Client(self.twilio_sid, self.twilio_token)
message = client.messages.create(
to=phone_number,
from_="+123456789", # Twilio numaranız ile değiştirin
body=message
)
return message.sid
except Exception as e:
return {"error": str(e)}
def generate_map(self, location):
try:
map_location = Map(location=location, zoom_start=10)
Marker(location).add_to(map_location)
map_location.save("location_map.html")
return "Harita HTML dosyası oluşturuldu: location_map.html"
except Exception as e:
return {"error": str(e)}
def analyze_text(self, text):
try:
blob = TextBlob(text)
return {
'polarity': blob.sentiment.polarity,
'subjectivity': blob.sentiment.subjectivity
}
except Exception as e:
return {"error": str(e)}
def get_weather(self, location):
try:
response = requests.get(f"http://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q={location}")
return response.json()
except Exception as e:
return {"error": str(e)}
def ip_lookup(self, ip_address):
try:
ip_info = IPWhois(ip_address)
return ip_info.lookup_rdap()
except Exception as e:
return {"error": str(e)}
def main():
phone_tool = PhoneTool(
os.getenv("SHODAN_API_KEY"),
os.getenv("TWILIO_ACCOUNT_SID"),
os.getenv("TWILIO_AUTH_TOKEN"),
os.getenv("NUMVERIFY_API_KEY")
)
phone_number = input("Telefon numaranızı girin (+90 xxx xxx xx xx): ")
verify_result = phone_tool.verify_phone(phone_number)
if not verify_result.get('valid'):
print("Numara geçerli değil.")
return
# Sonuçları sütun halinde göster
print(f"\n{'-'*50}")
print(f"Telefon Numarası: {phone_number}")
print(f"Bölge: {geocoder.description_for_number(phonenumbers.parse(phone_number, 'TR'), 'tr')}")
print(f"Operatör: {carrier.name_for_number(phonenumbers.parse(phone_number, 'TR'), 'tr')}")
print(f"Zaman Dilimi: {timezone.time_zones_for_number(phonenumbers.parse(phone_number, 'TR'))}")
print(f"{'-'*50}\n")
# Shodan sonuçları
print("Shodan sonuçları:")
shodan_results = phone_tool.shodan_search(phone_number)
for result in shodan_results['matches']:
print(f"IP: {result['ip_str']}, Port: {result['port']}")
print(f"{'-'*50}\n")
# SMS gönderme
sms_content = "Test mesajı: Bu mesaj numaranıza gönderildi."
send_sms_result = phone_tool.send_sms(phone_number, sms_content)
print(f"SMS gönderildi: {send_sms_result}")
print(f"{'-'*50}\n")
# Harita oluşturma
location = [41.0082, 28.9784] # İstanbul koordinatları
map_result = phone_tool.generate_map(location)
print(map_result)
print(f"{'-'*50}\n")
# Metin analizi
text = input("Analiz için metin girin: ")
analysis_result = phone_tool.analyze_text(text)
print(f"Metin Analizi:")
print(f"Polarity (Olumluluk): {analysis_result['polarity']}")
print(f"Subjectivity (Öznelik): {analysis_result['subjectivity']}")
print(f"{'-'*50}\n")
# Hava durumu bilgisi
weather_location = input("Hava durumu bilgisi için bir yer girin: ")
weather_result = phone_tool.get_weather(weather_location)
print(f"Hava Durumu:")
print(f"Yer: {weather_result['location']['name']}, Sıcaklık: {weather_result['current']['temp_c']}°C")
print(f"{'-'*50}\n")
# IP adresi araması
ip_address = input("IP adresi girin (sorgulama için): ")
ip_info = phone_tool.ip_lookup(ip_address)
print(f"IP Bilgisi:")
print(ip_info)
print(f"{'-'*50}\n")
if __name__ == "__main__":
main()