Added Support for PDF, Removed test statements
Signed-off-by: devoalda <linuxes_mojoworld@aleeas.com>
This commit is contained in:
parent
e49a45493b
commit
dd2c3b1904
|
@ -16,7 +16,8 @@ class file_steg:
|
|||
"docx",
|
||||
"xlsx",
|
||||
"csv",
|
||||
"pptx"
|
||||
"pptx",
|
||||
"pdf"
|
||||
]
|
||||
if file is None:
|
||||
raise ValueError(f"[-] Error: File path is required")
|
||||
|
@ -123,33 +124,6 @@ class file_steg:
|
|||
|
||||
def main():
|
||||
raise NotImplementedError("This module is not meant to run by itself")
|
||||
# with open("../Txt_Steg/secret_data.txt", "r") as f:
|
||||
# secret_data = f.read()
|
||||
#
|
||||
# bits_to_hide = np.random.choice(range(1, 9), np.random.randint(1, 9), replace=False)
|
||||
# bits_to_hide = list(bits_to_hide)
|
||||
# bits_to_hide.sort()
|
||||
# print(f"Bits to hide: {bits_to_hide}")
|
||||
#
|
||||
# mp3_file = "audio.mp3"
|
||||
# mp4_file = "video.mp4"
|
||||
# docx_file = "test.docx"
|
||||
# output_file_mp3 = "encoded_audio.mp3"
|
||||
# output_file_mp4 = "encoded_video.mp4"
|
||||
# output_docx_file = "encoded_test.docx"
|
||||
#
|
||||
# # Encode data, get as bytes
|
||||
# encoded_data = file_steg(file=mp3_file, bit_positions=bits_to_hide).encode(secret_data_str=secret_data)
|
||||
#
|
||||
# # Write encoded data to file
|
||||
# with open(output_file_mp3, "wb") as f:
|
||||
# f.write(encoded_data)
|
||||
#
|
||||
# # Decode data from mp3 file
|
||||
# decoded_data = file_steg(file=output_file_mp3, bit_positions=bits_to_hide).decode()
|
||||
#
|
||||
# # Print the decoded data
|
||||
# print("[+] Decoded data:", decoded_data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -123,28 +123,6 @@ class img_steg:
|
|||
|
||||
def main():
|
||||
raise NotImplementedError("This module is not meant to run by itself")
|
||||
# Variables
|
||||
# image_name = "test.bmp"
|
||||
# encoded_image_name = "encoded_image.bmp"
|
||||
# secret_data = ""
|
||||
# # with open("../Txt_Steg/secret_data.txt", "r") as f:
|
||||
# # secret_data = f.read()
|
||||
#
|
||||
# # Generate random bit positions to hide data into image for testing
|
||||
# bit_to_hide = np.random.choice(range(1, 9), np.random.randint(1, 9), replace=False)
|
||||
# bit_to_hide = list(bit_to_hide)
|
||||
# bit_to_hide.sort()
|
||||
# print(f"Bits to hide: {bit_to_hide}")
|
||||
#
|
||||
# print("Welcome to Image Steganography")
|
||||
#
|
||||
# # Encode the data into the image
|
||||
# encoded_image = img_steg(image_name=image_name, bit_to_hide=bit_to_hide).encode(secret_data)
|
||||
# cv2.imwrite(encoded_image_name, encoded_image)
|
||||
#
|
||||
# # Decode the data from the image
|
||||
# decoded_data = img_steg(image_name=encoded_image_name, bit_to_hide=bit_to_hide).decode()
|
||||
# print("Decoded Data:", decoded_data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -118,26 +118,6 @@ class txt_steg:
|
|||
|
||||
def main():
|
||||
raise NotImplementedError("This module is not meant to run by itself")
|
||||
# print("Welcome to Text Steganography")
|
||||
# text_file_name = "test.txt"
|
||||
# with open("../Txt_Steg/secret_data.txt", "r") as f:
|
||||
# secret_data = f.read()
|
||||
#
|
||||
# # Create a unique random number list from 1-8, spanning anywhere from 1-8 bits, for testing purposes
|
||||
# bits_to_hide = np.random.choice(range(1, 9), np.random.randint(1, 9), replace=False)
|
||||
# bits_to_hide = list(bits_to_hide)
|
||||
# bits_to_hide.sort()
|
||||
# print(f"Bits to hide: {bits_to_hide}")
|
||||
#
|
||||
# # Encode
|
||||
# encoded_file_name = "encoded_text.txt"
|
||||
# encoded_data = txt_steg(text_file=text_file_name, bit_to_hide=bits_to_hide).encode(secret_data)
|
||||
# with open(f"{encoded_file_name}", "w") as f:
|
||||
# f.write(encoded_data)
|
||||
#
|
||||
# # Decode
|
||||
# decoded_data = txt_steg(text_file=encoded_file_name, bit_to_hide=bits_to_hide).decode()
|
||||
# print(decoded_data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -158,36 +158,4 @@ class wav_steg:
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
wav_file = "sample.wav"
|
||||
output_file_wav = "encoded.wav"
|
||||
secret_txt = "payload.txt"
|
||||
|
||||
with open(secret_txt, "r") as f:
|
||||
secret_data = f.read()
|
||||
|
||||
bits_to_hide = np.random.choice(
|
||||
range(1, 9), np.random.randint(1, 9), replace=False)
|
||||
bits_to_hide = list(bits_to_hide)
|
||||
bits_to_hide.sort()
|
||||
bits_to_hide = [1, 2, 3, 4, 5]
|
||||
print(f"Bits to hide: {bits_to_hide}")
|
||||
|
||||
# Encode data, get as bytes
|
||||
encoded_data = wav_steg(wav_file=wav_file, bits_to_hide=bits_to_hide).encode(
|
||||
secret_data=secret_data)
|
||||
|
||||
# Write encoded data to file
|
||||
new_wav_file = wave.open(output_file_wav, "wb")
|
||||
new_wav_file.setnchannels(encoded_data["num_channels"])
|
||||
new_wav_file.setsampwidth(encoded_data["sample_width"])
|
||||
new_wav_file.setframerate(encoded_data["frame_rate"])
|
||||
new_wav_file.writeframes(encoded_data["num_frames"])
|
||||
# Close the New WAV file
|
||||
new_wav_file.close()
|
||||
|
||||
# Decode data from wav file
|
||||
decoded_data = wav_steg(wav_file=output_file_wav,
|
||||
bits_to_hide=bits_to_hide).decode()
|
||||
|
||||
# Print the decoded data
|
||||
# print("[+] Decoded data:", decoded_data)
|
||||
raise NotImplementedError("This module is not meant to be run as a script")
|
||||
|
|
|
@ -13,7 +13,7 @@ WORKING_PATH = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "uplo
|
|||
supported_files = {
|
||||
"txt_files": ["txt", "py", "sql", "html", "css", "js", "php", "c", "cpp", "java", "json", "xml", "yml", "md"],
|
||||
"gen_files": ["mp3", "mp4"],
|
||||
"doc_files": ["docx", "xlsx", "pptx", "csv"],
|
||||
"doc_files": ["docx", "xlsx", "pptx", "csv", "pdf"],
|
||||
"wav_files": ["wav"],
|
||||
"image_files": ["bmp", "png"]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue