Skip to content

Commit

Permalink
Merge pull request #10 from dr8co/dev
Browse files Browse the repository at this point in the history
Version 1.0.0 release
  • Loading branch information
dr8co authored Jan 21, 2024
2 parents 3f10839 + f2bf34f commit d7bad2b
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 82 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
# Copyright (C) 2023 Ian Duncan <[email protected]>
# Copyright (C) 2024 Ian Duncan <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -17,7 +17,7 @@
cmake_minimum_required(VERSION 3.25)

project(privacyShield
VERSION 0.1.0
VERSION 1.0.0
DESCRIPTION "A suite of tools for privacy and security"
LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion CMakeModules/FindGcrypt.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
# Copyright (C) 2023 Ian Duncan <[email protected]>
# Copyright (C) 2024 Ian Duncan <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion CMakeModules/FindReadline.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
# Copyright (C) 2023 Ian Duncan <[email protected]>
# Copyright (C) 2024 Ian Duncan <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/duplicateFinder/duplicateFinder.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/encryption/cryptoCipher.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/encryption/encryptDecrypt.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/encryption/encryptDecryptFiles.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/encryption/encryptDecryptStrings.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
9 changes: 6 additions & 3 deletions src/fileShredder/shredFiles.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -147,7 +147,11 @@ inline void renameAndRemove(const std::string &filename, int numTimes = 1) {
}

fs::remove(path, ec);
if (ec) std::cerr << "Failed to delete " << filename << ": " << ec.message() << '\n';
if (ec) {
printColor("Failed to delete ", 'r', false, std::cerr);
printColor(filename, 'm', false, std::cerr);
printColor(std::format(": {}", ec.message()), 'r', true, std::cerr);
}
}

/// \struct FileDescriptor
Expand Down Expand Up @@ -236,7 +240,6 @@ void simpleShred(const std::string &filename, const int &nPasses = 3, bool wipeC

// Restore last write time
fs::last_write_time(filename, initTime, ec);
if (ec) ec.clear();

// Rename and remove the file
renameAndRemove(filename, 3);
Expand Down
48 changes: 27 additions & 21 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -95,13 +95,19 @@ int main(int argc, char **argv) {
throw std::runtime_error("Failed to initialize libsodium.");

// Display information about the program
std::cout << "\nPrivacy Shield 1.0.0\n"
"Copyright (C) 2023 Ian Duncan.\n"
"This program comes with ABSOLUTELY NO WARRANTY.\n"
"This is a free software; you are free to change and redistribute it\n"
"under the terms of the GNU General Public License v3 or later.\n"
"For more information, see https://www.gnu.org/licenses/gpl.html.\n"
<< std::endl;
printColor("\nPrivacy Shield 1.0.0\n", 'c');
printColor("Copyright (C) 2024 Ian Duncan.\n", 'b');

printColor("This program comes with ", 'g');
printColor("ABSOLUTELY NO WARRANTY.", 'r');

printColor("\nThis is a free software; you are free to change and redistribute it\n"
"under the terms of the ", 'g');
printColor("GNU General Public License v3 ", 'r');
printColor("or later.", 'g');

printColor("\nFor more information, see ", 'g');
printColor("https://www.gnu.org/licenses/gpl.html.\n", 'b', true);

// All the available tools
std::unordered_map<int, std::function<void(void)>> apps = {
Expand All @@ -114,14 +120,14 @@ int main(int argc, char **argv) {

// Applications loop
while (true) {
std::cout << "-------------------------------------\n";
std::cout << "1. Manage passwords\n";
std::cout << "2. Encrypt/decrypt files\n";
std::cout << "3. Shred files\n";
std::cout << "4. Clear browser privacy traces\n";
std::cout << "5. Find duplicate files\n";
std::cout << "6. Exit\n";
std::cout << "-------------------------------------" << std::endl;
printColor("-------------------------------------\n", 'c');
printColor("1. Manage passwords\n", 'b');
printColor("2. Encrypt/decrypt files\n", 'g');
printColor("3. Shred files\n", 'm');
printColor("4. Clear browser privacy traces\n", 'y');
printColor("5. Find duplicate files\n", 'b');
printColor("6. Exit\n", 'r');
printColor("-------------------------------------", 'c', true);

int choice = getResponseInt("What would you like to do? (Enter 1 or 2, 3..)");

Expand All @@ -135,27 +141,27 @@ int main(int argc, char **argv) {
else printColor("Invalid choice!", 'r', true, std::cerr);

} catch (const std::bad_function_call &bc) { // In case the std::function objects are called inappropriately
std::cerr << "Bad function call: " << bc.what() << std::endl;
printColor(std::format("Bad function call: {}", bc.what()), 'r', true, std::cerr);
continue;

} catch (const std::exception &ex) {
std::cerr << "Error: " << ex.what() << std::endl;
printColor(std::format("Error: {}", ex.what()), 'r', true, std::cerr);
continue;

} catch (...) { // All other exceptions, if any
std::cerr << "An error occurred." << std::endl;
printColor("An error occurred.", 'r', true, std::cerr);
continue;
}
}

return 0;

} catch (const std::exception &ex) {
std::cerr << "Error: " << ex.what() << std::endl;
printColor(std::format("Error: {}", ex.what()), 'r', true, std::cerr);
return 1;

} catch (...) {
std::cerr << "Something went wrong." << std::endl;
printColor("Something went wrong.", 'r', true, std::cerr);
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/passwordManager/FuzzyMatcher.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/passwordManager/passwordManager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/passwordManager/passwords.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Privacy Shield: A Suite of Tools Designed to Facilitate Privacy Management.
// Copyright (C) 2023 Ian Duncan <[email protected]>
// Copyright (C) 2024 Ian Duncan <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
Loading

0 comments on commit d7bad2b

Please sign in to comment.