0
import time
import binascii
import time
from scapy.all import *
import socket
from openpyxl import load_workbook

filepath = "c:/Users/Don/PycharmProjects/HVACSCHEDULE-PLUS/Updates.xlsx"
wb = load_workbook(filepath)
print(wb.sheetnames)
sheet = wb['Sync']
updatedata = sheet["B1"].value
updatedata2 = updatedata.replace(" ", "")
print("This is Update Data", updatedata2)
message = binascii.a2b_hex(updatedata2)

try:
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    p = IP(dst="192.168.1.47")/TCP(flags="A", sport=RandShort(), dport=10001) / message
    s.connect(("192.168.1.47", 10001))
    time.sleep(150)
    print(bytes(p))
    s.send(bytes(p))
    print("Request sent!")

except:
    print("An error occurred.")
C:\Users\Don\PycharmProjects\HVACSCHEDULE-PLUS\venv\Scripts\python.exe C:/Users/Don/PycharmProjects/HVACSCHEDULE-PLUS/Setup.py
['Current Status', 'Sync', 'Sheet3']
This is Update Data aa5506c0025fa1c8
b"E\x00\x000\x00\x01\x00\x00@\x06\xc1=\xc0\xa87\n\xc0\xa8\x01/\xd3\xf1'\x11\x00\x00\x00\x00\x00\x00\x00\x00P\x10 \x00\x86\x02\x00\x00\xaaU\x06\xc0\x02_\xa1\xc8"
Request sent!

Process finished with exit code 0

enter image description here

ForceBru
  • 43,482
  • 10
  • 63
  • 98
Don Odom
  • 11
  • 2

1 Answers1

0

you are asking to sent those bytes:

p = IP(dst="192.168.1.47")/TCP(flags="A", sport=RandShort(), dport=10001) / message

if you only want to send your payload:

p = message

Now, in that case, you only open a normal TCP socket and send data thru it. Why do you need scapy?

fgagnaire
  • 839
  • 9
  • 18