forked from Telefonica/HomePWN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclone.py
More file actions
47 lines (41 loc) · 1.89 KB
/
clone.py
File metadata and controls
47 lines (41 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Adapting script from https://nfcpy.readthedocs.io/en/latest/
# Thanks to nehpetsde
# Author: @lucferbux
from modules._module import Module
from utils.custom_print import print_info, print_ok, print_error, print_body
from utils.check_root import is_root
from utildata.dataset_options import Option
from modules.nfc.load import HomeModule as Load
from modules.nfc.dump import HomeModule as Dump
class HomeModule(Module):
def __init__(self):
information = {"Name": "Clone NFC file",
"Description": "This module dumps the contents of an nfc tag in a file and then load this content in a new nfc tag.",
"privileges": "root",
"OS": "Linux",
"Reference" : "https://nfcpy.readthedocs.io/en/latest/",
"Author": "@lucferbux, @josueencinar"}
options = {
'reader': Option.create(name="reader", value="usb", required=True, description="reader used to write the tag"),
'file': Option.create(name="file", value="tag.ndef", required=True, description="destination file to dump the content and then load it"),
}
# Constructor of the parent class
super(HomeModule, self).__init__(information, options)
# This function must be always implemented, it is called by the run option
@is_root
def run(self):
dump = Dump()
load = Load()
reader_v = ["reader", self.args["reader"]]
file_v = ["file", self.args["file"]]
input("Press any key to dump data from a NFC file")
print_info("Setting dump options")
dump.set_value(reader_v)
dump.set_value(file_v)
dump.run()
input("Change NFC file and press any key to load the content")
print_info("Setting load options")
load.set_value(reader_v)
load.set_value(file_v)
load.run()
print_ok("Done!")