Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 21b3c4de52 | |||
| 3a854c3ccf | |||
| 877add0dbf | |||
| 482687cb68 | |||
| e35d94243e |
@@ -1 +0,0 @@
|
||||
Test file content for decryption
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
|
||||
-----BEGIN OTP MESSAGE-----
|
||||
Version: v0.2.72
|
||||
Pad-ChkSum: 97d9d82b5414a9439102f3811fb90ab1d6368a00d33229a18b306476f9d04f82
|
||||
Pad-Offset: 2873419
|
||||
|
||||
iR6J7HHK1Oc6
|
||||
-----END OTP MESSAGE-----
|
||||
|
||||
|
||||
14
otp.c
14
otp.c
@@ -138,11 +138,16 @@ int main(int argc, char* argv[]) {
|
||||
// Check for piped input first (before any output)
|
||||
int is_pipe_mode = (argc == 1 && has_stdin_data());
|
||||
|
||||
// Check for decrypt command with piped input
|
||||
int is_decrypt_pipe = (argc == 2 &&
|
||||
(strcmp(argv[1], "decrypt") == 0 || strcmp(argv[1], "-d") == 0) &&
|
||||
has_stdin_data());
|
||||
|
||||
// Check for OTP thumb drive on startup
|
||||
char otp_drive_path[512];
|
||||
if (detect_otp_thumb_drive(otp_drive_path, sizeof(otp_drive_path))) {
|
||||
// Only show messages in interactive/command mode, not pipe mode
|
||||
if (!is_pipe_mode) {
|
||||
if (!is_pipe_mode && !is_decrypt_pipe) {
|
||||
printf("Detected OTP thumb drive: %s\n", otp_drive_path);
|
||||
printf("Using as default pads directory for this session.\n\n");
|
||||
}
|
||||
@@ -1648,6 +1653,10 @@ int decrypt_text_silent(const char* pad_identifier, const char* encrypted_messag
|
||||
else if (in_data_section) {
|
||||
strncat(base64_data, line_ptr, sizeof(base64_data) - strlen(base64_data) - 1);
|
||||
}
|
||||
else if (strncmp(line_ptr, "Version:", 8) != 0 && strncmp(line_ptr, "Pad-", 4) != 0) {
|
||||
// This might be base64 data without a blank line separator
|
||||
strncat(base64_data, line_ptr, sizeof(base64_data) - strlen(base64_data) - 1);
|
||||
}
|
||||
}
|
||||
line_ptr = strtok(NULL, "\n");
|
||||
}
|
||||
@@ -1724,8 +1733,9 @@ int decrypt_text_silent(const char* pad_identifier, const char* encrypted_messag
|
||||
}
|
||||
plaintext[ciphertext_len] = '\0';
|
||||
|
||||
// Output only the decrypted text - no extra messages
|
||||
// Output only the decrypted text with newline and flush
|
||||
printf("%s\n", plaintext);
|
||||
fflush(stdout);
|
||||
|
||||
// Cleanup
|
||||
free(ciphertext);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Testing updated files directory functionality
|
||||
@@ -1 +0,0 @@
|
||||
Testing files directory functionality
|
||||
BIN
test_new.txt.otp
BIN
test_new.txt.otp
Binary file not shown.
Reference in New Issue
Block a user