pip install python_arptable
from typing import Optional
from python_arptable import get_arp_table
def get_ip_by_mac(macaddr: str) -> Optional[str]:
if record := next(filter(lambda i: i['HW address'].lower() == macaddr.lower(), get_arp_table()), None):
return record['IP address']
print(get_ip_by_mac('00:50:56:96:31:06')) # 10.0.20.91
import requests
http = requests.Session()
my_cookies = {'Abc': '123', 'Def': '456'}
http.cookies.update(my_cookies)
r = http.post('https://auth.roblox.com/v2/login', ...)
import glob
import shutil
files_to_copy = glob.glob('C:/Users/kolom/Desktop/Main programm/Auto_EGAIS/exe/*.ovpn')
destination_path = (r'C:/Program Files/OpenVPN/config/')
for file in files_to_copy:
shutil.copy2(file, destination_path)
import operator
def arithmetic(a: int, b: int, operation):
if operation not in (operator.add, operator.sub, operator.mul, operator.truediv):
print('Unknown operation')
else:
print(operation(a, b))
arithmetic(1, 2, operator.mul)
operators = {
'+': operator.add,
'-': operator.sub,
'*': operator.mul,
'/': operator.truediv
}
arithmetic(1, 2, operators['*'])
import re
s = "новая версия вчера - version1"
r = re.search(r'[a-zA-Z]{7}\d', s)
print(r.group())
class Client:
def __init__(self, client_id, name, phone, location, time):
self.client_id = client_id
self.name = name
self.phone = phone
self.location = location
self.time = time
my_client = Client(123456, "Vasya", "123456", "Lviv", 1234567890)
print(my_client.client_id)
import requests
import vk_api
s = requests.Session()
s.proxies.update({'http': 'http://10.11.4.254:3128'})
vk_session = vk_api.VkApi('+71234567890', 'mypassword', session=s)
vk_session.auth()
vk = vk_session.get_api()
print(vk.wall.post(message='Hello world!'))