mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
make style
This commit is contained in:
parent
e3e33a6501
commit
b55c186b3a
5 changed files with 22 additions and 20 deletions
14
client/pyscripts/theremin.py
Normal file → Executable file
14
client/pyscripts/theremin.py
Normal file → Executable file
|
@ -28,9 +28,9 @@ p = pyaudio.PyAudio()
|
||||||
|
|
||||||
# For paFloat32 sample values must be in range [-1.0, 1.0]
|
# For paFloat32 sample values must be in range [-1.0, 1.0]
|
||||||
stream = p.open(format=pyaudio.paFloat32,
|
stream = p.open(format=pyaudio.paFloat32,
|
||||||
channels=1,
|
channels=1,
|
||||||
rate=sampling_freq,
|
rate=sampling_freq,
|
||||||
output=True)
|
output=True)
|
||||||
|
|
||||||
# Initial voltage to frequency values
|
# Initial voltage to frequency values
|
||||||
min_v = 100.0
|
min_v = 100.0
|
||||||
|
@ -40,7 +40,7 @@ out_freq = min_freq
|
||||||
|
|
||||||
# Spawn the Proxmark3 client
|
# Spawn the Proxmark3 client
|
||||||
pm3_proc = Popen([pm3_client, pm3_reader_dev_file, "-c", pm3_tune_cmd],
|
pm3_proc = Popen([pm3_client, pm3_reader_dev_file, "-c", pm3_tune_cmd],
|
||||||
bufsize=0, env={}, stdin=DEVNULL, stdout=PIPE, stderr=DEVNULL)
|
bufsize=0, env={}, stdin=DEVNULL, stdout=PIPE, stderr=DEVNULL)
|
||||||
mv_recbuf = ""
|
mv_recbuf = ""
|
||||||
|
|
||||||
# Read voltages from the Proxmark3, generate the sine wave, output to soundcard
|
# Read voltages from the Proxmark3, generate the sine wave, output to soundcard
|
||||||
|
@ -66,7 +66,8 @@ while True:
|
||||||
max_v = v
|
max_v = v
|
||||||
|
|
||||||
# Recalculate the audio frequency to generate
|
# Recalculate the audio frequency to generate
|
||||||
out_freq = (max_freq - min_freq) * (max_v - v) / (max_v - min_v) + min_freq
|
out_freq = (max_freq - min_freq) * (max_v - v) / (max_v - min_v) \
|
||||||
|
+ min_freq
|
||||||
|
|
||||||
# Generate the samples and write them to the soundcard
|
# Generate the samples and write them to the soundcard
|
||||||
sinevs = out_freq / sampling_freq * numpy.pi * 2
|
sinevs = out_freq / sampling_freq * numpy.pi * 2
|
||||||
|
@ -75,4 +76,5 @@ while True:
|
||||||
sinev = sinev if sinev < numpy.pi * 2 else sinev - numpy.pi * 2
|
sinev = sinev if sinev < numpy.pi * 2 else sinev - numpy.pi * 2
|
||||||
i = (i + 1) % sample_buf_size
|
i = (i + 1) % sample_buf_size
|
||||||
if not i:
|
if not i:
|
||||||
stream.write((numpy.sin(sample_buf) * volume).astype(numpy.float32).tobytes())
|
stream.write((numpy.sin(sample_buf) * volume).
|
||||||
|
astype(numpy.float32).tobytes())
|
||||||
|
|
|
@ -770,7 +770,7 @@ static int CmdHFiClassELoad(const char *Cmd) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EML: {
|
case EML: {
|
||||||
res = loadFileEML_safe(filename, (void**)&dump, &bytes_read);
|
res = loadFileEML_safe(filename, (void **)&dump, &bytes_read);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case JSON: {
|
case JSON: {
|
||||||
|
@ -1676,7 +1676,7 @@ static int CmdHFiClassCloneTag(const char *Cmd) {
|
||||||
|
|
||||||
uint8_t *dump = NULL;
|
uint8_t *dump = NULL;
|
||||||
size_t bytes_read = 0;
|
size_t bytes_read = 0;
|
||||||
if (loadFile_safe(filename, "", (void**)&dump, &bytes_read) != PM3_SUCCESS) {
|
if (loadFile_safe(filename, "", (void **)&dump, &bytes_read) != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(FAILED, "File: " _YELLOW_("%s") ": not found or locked.", filename);
|
PrintAndLogEx(FAILED, "File: " _YELLOW_("%s") ": not found or locked.", filename);
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
|
@ -2040,7 +2040,7 @@ static int CmdHFiClassReadTagFile(const char *Cmd) {
|
||||||
|
|
||||||
uint8_t *dump = NULL;
|
uint8_t *dump = NULL;
|
||||||
size_t bytes_read = 0;
|
size_t bytes_read = 0;
|
||||||
if (loadFile_safe(filename, "", (void**)&dump, &bytes_read) != PM3_SUCCESS) {
|
if (loadFile_safe(filename, "", (void **)&dump, &bytes_read) != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(FAILED, "File: " _YELLOW_("%s") ": not found or locked.", filename);
|
PrintAndLogEx(FAILED, "File: " _YELLOW_("%s") ": not found or locked.", filename);
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
|
@ -2190,7 +2190,7 @@ static int loadKeys(char *filename) {
|
||||||
|
|
||||||
uint8_t *dump = NULL;
|
uint8_t *dump = NULL;
|
||||||
size_t bytes_read = 0;
|
size_t bytes_read = 0;
|
||||||
if (loadFile_safe(filename, "", (void**)&dump, &bytes_read) != PM3_SUCCESS) {
|
if (loadFile_safe(filename, "", (void **)&dump, &bytes_read) != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(FAILED, "File: " _YELLOW_("%s") ": not found or locked.", filename);
|
PrintAndLogEx(FAILED, "File: " _YELLOW_("%s") ": not found or locked.", filename);
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ static int usage_lf_viking_sim(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CmdVikingDemod(const char *Cmd) {
|
static int CmdVikingDemod(const char *Cmd) {
|
||||||
return demodViking();
|
return demodViking();
|
||||||
}
|
}
|
||||||
|
|
||||||
//see ASKDemod for what args are accepted
|
//see ASKDemod for what args are accepted
|
||||||
|
@ -64,7 +64,7 @@ int demodViking(void) {
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = DemodBufferLen;
|
size_t size = DemodBufferLen;
|
||||||
int ans = detectViking(DemodBuffer, &size);
|
int ans = detectViking(DemodBuffer, &size);
|
||||||
if (ans < 0) {
|
if (ans < 0) {
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Viking Demod %d %s", ans, (ans == -5) ? _RED_("[chksum error]") : "");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - Viking Demod %d %s", ans, (ans == -5) ? _RED_("[chksum error]") : "");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue