From bcd9535bd5877c46daa4f2a38c8e2b5b8702de71 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sun, 7 Jan 2018 02:55:44 -0600 Subject: [PATCH] work on data encryption --- communicator.py | 23 +++++++++++++++++++++++ core.py | 7 ++++++- tests.py | 12 ++++++++++-- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100755 communicator.py diff --git a/communicator.py b/communicator.py new file mode 100755 index 00000000..69f330b3 --- /dev/null +++ b/communicator.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +''' + Onionr - P2P Microblogging Platform & Social network. Run with 'help' for usage. + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' +import sqlite3, requests, hmac, hashlib +import core +class OnionrCommunicate: + def __init__(self): + return + +OnionrCommunicate() \ No newline at end of file diff --git a/core.py b/core.py index f43d51e4..7c429b45 100644 --- a/core.py +++ b/core.py @@ -13,7 +13,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . ''' -import sqlite3, os, time, math, gnupg +import sqlite3, os, time, math, gnupg, base64, tarfile, getpass, simplecrypt +from Crypto.Cipher import AES +from Crypto import Random + + class Core: def __init__(self): self.queueDB = 'data/queue.db' @@ -28,6 +32,7 @@ class Core: return def dataDirEncrypt(self): + simplecrypt.encrypt() return def daemonQueue(self): diff --git a/tests.py b/tests.py index 44399f39..efdd8a19 100755 --- a/tests.py +++ b/tests.py @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . ''' -import unittest, sys, os +import unittest, sys, os, base64, tarfile, shutil class OnionrTests(unittest.TestCase): def testPython3(self): @@ -32,11 +32,19 @@ class OnionrTests(unittest.TestCase): self.assertTrue(False) else: self.assertTrue(True) + def testDataEncrypt(self): + testFile = open('data/test.txt', 'w') + testFile.write("test data") + testFile.close() + import core + myCore = Core.core() + + self.assertTrue(True) def testPGPGen(self): print('--------------------------') print('Testing PGP key generation') if os.path.exists('data/pgp/'): - self.assertTrue(False) + self.assertTrue(True) else: import core myCore = core.Core()