Research, development and trades concerning the powerful Proxmark3 device.
Remember; sharing is caring. Bring something back to the community.
"Learn the tools of the trade the hard way." +Fravia
You are not logged in.
Time changes and with it the technology
Proxmark3 @ discord
Users of this forum, please be aware that information stored on this site is not private.
Pages: 1
Hello all,
does someone know whether I can run the commands of the pm3 interface via external calls (e.g. hf sniff 10000 1 with Python scripts)?
I would like to automatically sniff hf traces and save these traces on my computer about 5000 times for research purposes without needing to enter the proper commands every time by my one.
Regards,
Niklas
Offline
I have found out how to solve this issue by my own.
Here is the code for the case someone has a similar problem:
from __future__ import print_function
from __future__ import absolute_import
import pexpect
from pexpect import ANSI
port: str = "" # Keep empty for auto-detection
if port == "":
pm3_start_command = "pm3"
else:
pm3_start_command = "pm3 -p " + port
class Sniffer:
def __init__(self, engine=pm3_start_command, iterations=5000):
self.iterations = iterations
self.child = pexpect.spawn(engine)
self.term = ANSI.ANSI()
def sniff(self, samples_skip=10000, trigger_skip=1):
self.child.expect('pm3 -->')
self.child.sendline('hf sniff ' + str(samples_skip) + ' ' + str(trigger_skip))
def save(self, filename):
self.child.expect('pm3 -->')
self.child.sendline('data save f ' + filename)
def quit(self):
self.child.sendline('quit')
def main():
print("Starting pm3 interface...")
sniffer = Sniffer()
print("Starting sniffer for " + str(sniffer.iterations) + " iterations...")
for i in range(sniffer.iterations):
sniffer.sniff()
print("Sniffing trace no. " + str(i + 1) + "...")
sniffer.save("trace_" + str(i + 1))
print("Saving trace no. " + str(i + 1) + "...")
sniffer.quit()
if __name__ == "__main__":
main()
Offline
Pages: 1