Navigation Menu

Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
richo committed Apr 18, 2020
1 parent a0bcd95 commit f95d2a1
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions roullette.py
@@ -1,14 +1,13 @@
#!/usr/bin/env python
# Amiibo roullette
import argparse
import os
import random
import subprocess
import sys
import tempfile
import subprocess
import argparse


PROMPT="pm3 -->"

def mklog(c):
def inner(m):
print('[' + c + '] ' + m)
Expand All @@ -24,6 +23,9 @@ def arg_parser():
parser.add_argument('--single', dest='single', action='store_true',
default=False,
help='Load the specified amiibo instead of random one')
parser.add_argument('--reveal', dest='reveal', action='store_true',
default=False,
help='Tell you which amiibo is being loaded if you hate surprises')
parser.add_argument('--device', dest='device', action='store',
default="/dev/ttyACM0",
help='Use the specified device')
Expand Down Expand Up @@ -69,13 +71,23 @@ def run(self, cmd):
out, err = self.proxmark.communicate()
log(out)

def get_random_bin(path):
def bins():
for _, _, files in os.walk(path):
for filename in files:
if filename.endswith(".bin"):
yield filename
return random.choice([bin in bins()])

def main():
parser = arg_parser()
args = parser.parse_args()
if args.single:
amiibo = args.source
else:
amiibo = get_random_bin(args.source)
if args.reveal:
log("Loading {}".format(amiibo))

mfubin2eml = os.environ["MFUBIN2EML"]
wrapper = Mfubin2emlWrapper(mfubin2eml)
Expand Down

0 comments on commit f95d2a1

Please sign in to comment.