def controlPrinter(mac, port, img): try: btPrinter = obexftp.client(obexftp.BLUETOOTH) btPrinter.connect(mac,port) btPrinter.put_file(img) print '[+] Printed Image.' except: print '[-] Failed to print Image.'
def print(addr, file): try: btPrinter = obexftp.client(obexftp.BLUETOOTH) btPrinter.connect(addr) btPrinter.put_file(file) print('[+] Printed file') except: print('[-] Failed to print file')
def imagePrint(mac, port, imageFile): # RFCOMM 프로토콜의 OBEX Object Push 서비스를 제어해 이미지를 프린터로 전송한다. try: btPrinter=obexftp.client(obexftp.BLUETOOTH) btPrinter.connect(mac, port) # Obexftp로 프린터에 연결 btPrinter.put_file(imageFile) # 공격자의 컴퓨터에서 이미지파일을 프린터로 전송 print "[+] Printed Image" except: print "[-] Failed to print Image"
def sendFile(dev, filename): if os.path.exists(filename): client = obexftp.client(obexftp.BLUETOOTH) channel = obexftp.browsebt(dev, obexftp.PUSH) print '[>] Sending file to %s@%s' % (dev, str(channel)) client.connect(dev, channel) ret = client.put_file(filename) if int(ret) >= 1: print '[>] File has been sent.' else: print '[!] File has not been accepted.' client.disconnect() else: print '[!] Specified file: "%s" does not exists.'
#!/usr/bin/env python import obexftp try: btPrinter = obexftp.client(obexftp.BLUETOOTH) # Replace MAC with target MAC btPrinter.connect('00:11:22:33:44:55', 2) btPrinter.put_file('/tmp/ninja.jpg') print '[+] Printed Ninja Image.' except: print '[-] Failed to print Ninja Image.'
#!/usr/bin/python import obexftp obex = obexftp.client(obexftp.BLUETOOTH) devs = obex.discover(); print devs; dev = devs[0] print "Using %s" % dev channel = obexftp.browsebt(dev,0) print "Channel %d" % channel print obex.connect(dev, channel) print obex.list("/") print obex.list("/images") data = obex.get("/images/some.jpg") file = open('downloaded.jpg', 'wb') file.write(data) print obex.disconnect() obex.delete
def __init__(self, address, port): self.client = obexftp.client(obexftp.BLUETOOTH) self.address = address self.port = port
#!/usr/bin/python # -*- coding: utf-8 -*- import obexftp try: btPrinter = obexftp.client(obexftp.BLUETOOTH) btPrinter.connect("00:16:38:DE:AD:11", 2) btPrinter.put_file("/tmp/ninja.jpg") print "[+] Printed Ninja Image." except: print "[-] Failed to print Ninja Image."
#!/usr/bin/python import obexftp obex = obexftp.client(obexftp.BLUETOOTH) devs = obex.discover() print devs dev = devs[0] print "Using %s" % dev channel = obexftp.browsebt(dev, 0) print "Channel %d" % channel print obex.connect(dev, channel) print obex.list("/") print obex.list("/images") data = obex.get("/images/some.jpg") file = open("downloaded.jpg", "wb") file.write(data) print obex.disconnect() obex.delete