This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
rfiddriver/utils.py

20 lines
400 B
Python

import socket
from datetime import datetime
from time import sleep
def unix_time(dt):
epoch = datetime.utcfromtimestamp(0)
delta = dt - epoch
return delta.total_seconds()
def netcat(hostname, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((hostname, port))
s.sendall(content)
sleep(0.005)
s.shutdown(socket.SHUT_WR)
s.close()