Coder Social home page Coder Social logo

dont_trust's Introduction

donttrust

  ;                    
  ED.                  
  E#Wi                 
  E###G.               
  E#fD#W;     GEEEEEEEL
  E#t t##L    ,;;L#K;;.
  E#t  .E#K,     t#E   
  E#t    j##f    t#E   
  E#t    :E#K:   t#E   
  E#t   t##L     t#E   
  E#t .D#W;      t#E   
  E#tiW#G.       t#E   
  E#K##i         t#E   
  E##D.           fE   
  E#t              :   
  L:                   

Each time a different onion service is created, that being the case, if trying to connect right after the creation, a minute or two may be needed given the fact the onion service may still be having a proper integration to the tor network

Secure one-to-one communication, opsec focused

Maybe n-to-n someday, but no plans for now, given the fact this application is intended to be small

Table of contents

Development environment

compile_flags.txt is for usage with clangd
The c standard being used is a dialect from c17, that being gnu17

Building

Dependencies

  • gcc
  • libcrypto3 (From openssl3) header files
  • make (Or run the build command from the Makefile directly)

Fedora 39

sudo dnf install openssl-devel openssl-libs

Debian 12

sudo apt-get update
sudo apt-get install libssl-dev libssl3

To build:

$ make

The result will be at ./buid/donttrust

Installation

Download and install the package of choice at the releases page

Usage

  • Press "ESC" to change between "EDIT" and "VIEW" modes
  • Press "j" to go down and "k" to go up
  • Press "ENTER" to send the message

You must provide your rsa private key and the rsa public key from your peer:

Dear tor users, "PGP keys" can be used as long the key is RSA, which is the default algorithm for key generation in software like GnuPG and many others
$ donttrust --pKey "./client_private_key_path.txt" --pubKey "./peer_public_key_path.pem"
The file type does not matter but the keys must be PEM encoded
The possible sizes are those supported by libcrypto3 from openssl3

Connecting

To connect to an ipv4 address:
$ donttrust -t 192.168.0.1
The address must be human readable
To connect to an onion address:
$ donttrust -o vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion

Listening for connections

To listen for normal ones:
$ donttrust ...
Just dont use any connection option, that being "-t" and "-o"
To listen for onion ones:

Before that, do this first time setup:
1 - Generate a hashed password for control port access, <your_password> length must not be bigger than 1000:

$ tor --hash-password <your_password>

2 - On your "torrc" file, add the following:

ControlPort 9051
HashedControlPassword <The result from the above command>

3 - Reload the configs if tor is running:

$ sudo kill -s SIGHUP <tor process id>

Just provide your password

$ donttrust --torControlPassword <your_password>

Protocol Specification

Runs on top of tcp, there are 2 commands available:

A command is considered a network byte order 8 bits unsigned integer sent over the tcp byte stream

0x01 = Starts a message

After which should be on the following order:

  • An unsigned 32 bit number in network byte order, that's the message code
  • An unsigned 32 bit number in network byte order containing the cipher text size in bytes
  • The initialization vector used to decrypt the cipher text, a sequence of 16 bytes
  • The private key encrypted session key (AES in this case) used to decrypt the ciphertext, a sequence of 256 bytes
  • The cipher text, up to a maximum of 65552 bytes length

0x02 = Starts a message confirmation

After which should be on the following order:

  • An unsigned 32 bit number in network byte order, that's the number of confirmations codes
  • n unsigned 32 bit numbers in network byte order, each being a message code from a particular message (Only your own messages have their code saved in the application, that's implementation dependent)

Customization

Changing button for application mode change:

There are 2, "VIEW" and "EDIT", the default button for changing is the 0x1B ASCII code (ESC button)
Update "STATUS_CHANGE_BUTTON" at "src/common/common.h" to a desired ASCII code

Changing buttons for line moving:

If the program is on "VIEW" mode, bytes coming from stdin are used to go up or down
Update "UP_BUTTON" or "DOWN_BUTTON" at "src/common/common.h" to a desired ASCII code, the defaults are 'k' for "UP_BUTTON" and 'j' for "DOWN_BUTTON"

For the following color reletad changes, refer to some terminal 256 color ids table

Changing background color:

Update "TERMINAL_BACKGROUND_COLOR_ID" from "src/common/common.h" to a desired terminal color id

Changing status line color:

Update "STATUS_LINE_TERMINAL_COLOR_CODE" from "src/common/common.h" to a desired terminal color id
The default is "27" (Some blue tone)

Changing sent messages color:

Not yet received by peer

Update the value of "PEER_NOT_RECEIVED_TERMINAL_BACKGROUND_COLOR_ID" from "src/common/common.h"
The default is "196" (Some red tone)

Already received by peer

Update the value of "PEER_RECEIVED_TERMINAL_BACKGROUND_COLOR_ID" from "src/common/common.h"
The default is "41" (Some green tone)

Changing received messages color:

Update the value of "RECEIVED_TERMINAL_BACKGROUND_COLOR_ID" from "src/common/common.h"
The default is "232" (Black)

Motivation, philosophy and goals

  • The need for information confidentiality
  • Guarantee that the software does only what is intended
  • No time to manually check the code of big open source projects
  • No need for large communication protocols
  • Very organized codebase files, easy to understand and hack
  • Secure by default
  • Minimal dependencies

dont_trust's People

Contributors

alvorada9999 avatar

Stargazers

Lucas Jett avatar Guilherme Santos avatar Davi Santos avatar  avatar Hipolit Badowski avatar  avatar

Watchers

 avatar

dont_trust's Issues

Input bug

Sending the following text from peer A to peer B causes B to read the stream socket 2 times:

f[B[B[B[B[B[Bf[A[A[A[Af[B[B[B[B[B[Bf[A[A[A[A[A[A[B[B[B[Bf[B[B[A[A[A[A[A[Af[B[B[B[B[B[B[B[B[A[A[A[A[A[Af[A[A[B[B[B[B[B[B[B[B[B[B[A[Af[A[A[A[A[A[A[A[A[B[B[B[B[B[B[B[B[B[B[B[B[A[Af[A[A[A[A[A[A[A[A[A[A[B[B[B[B[B[B[B[B[B[B[B[Bf[A[A[A[A[A[A[A[A[A[A[B[B[B[B[B[B[B[B[B

Using the app normally I wasn't able to find such problems, I found this one when giving input by accident when using the mouse scroll button, that generated such sequence of bytes

On the first one, 267 is returned, that's the 7 bytes from the protocol, 260 from the text

On the second one, a wrong value (The tcp stream is empty and the value is positive) is returned from read (no signal interrupt or more data coming from A), mostly being equals the count from read!!! (No wrong data types or mixing unsigned and signed numbers here

This causes the peer B to loop over the buffer again and read an invalid command, thus exiting the application, that's a debug output from peer B when using the "input_bug" (The relevant code lies at "src/common/readFromPeer.c") branch code:

Waiting connection
Connection established


------ CALL TO read(), returned value: 267

Iteration: 0 | Decimal = 1 | Char = 
Iteration: 1 | Decimal = 0 | Char = 
Iteration: 2 | Decimal = 0 | Char = 
Iteration: 3 | Decimal = 0 | Char = 
Iteration: 4 | Decimal = 0 | Char = 
Iteration: 5 | Decimal = 1 | Char = 
Iteration: 6 | Decimal = 4 | Char = 
Iteration: 7 | Decimal = 102 | Char = f
Iteration: 8 | Decimal = 91 | Char = [
Iteration: 10 | Decimal = 91 | Char = [
Iteration: 11 | Decimal = 66 | Char = B
Iteration: 12 | Decimal = 91 | Char = [
Iteration: 13 | Decimal = 66 | Char = B
Iteration: 14 | Decimal = 91 | Char = [
Iteration: 15 | Decimal = 66 | Char = B
Iteration: 17 | Decimal = 66 | Char = B
Iteration: 18 | Decimal = 91 | Char = [
Iteration: 19 | Decimal = 66 | Char = B
Iteration: 20 | Decimal = 102 | Char = f
Iteration: 22 | Decimal = 65 | Char = A
Iteration: 23 | Decimal = 91 | Char = [
Iteration: 25 | Decimal = 91 | Char = [
Iteration: 26 | Decimal = 65 | Char = A
Iteration: 27 | Decimal = 91 | Char = [
Iteration: 28 | Decimal = 65 | Char = A
Iteration: 30 | Decimal = 91 | Char = [
Iteration: 31 | Decimal = 66 | Char = B
Iteration: 32 | Decimal = 91 | Char = [
Iteration: 33 | Decimal = 66 | Char = B
Iteration: 34 | Decimal = 91 | Char = [
Iteration: 35 | Decimal = 66 | Char = B
Iteration: 36 | Decimal = 91 | Char = [
Iteration: 37 | Decimal = 66 | Char = B
Iteration: 38 | Decimal = 91 | Char = [
Iteration: 39 | Decimal = 66 | Char = B
Iteration: 40 | Decimal = 91 | Char = [
Iteration: 41 | Decimal = 66 | Char = B
Iteration: 42 | Decimal = 102 | Char = f
Iteration: 43 | Decimal = 91 | Char = [
Iteration: 44 | Decimal = 65 | Char = A
Iteration: 45 | Decimal = 91 | Char = [
Iteration: 46 | Decimal = 65 | Char = A
Iteration: 47 | Decimal = 91 | Char = [
Iteration: 48 | Decimal = 65 | Char = A
Iteration: 49 | Decimal = 91 | Char = [
Iteration: 50 | Decimal = 65 | Char = A
Iteration: 51 | Decimal = 91 | Char = [
Iteration: 52 | Decimal = 65 | Char = A
Iteration: 53 | Decimal = 91 | Char = [
Iteration: 54 | Decimal = 65 | Char = A
Iteration: 55 | Decimal = 91 | Char = [
Iteration: 56 | Decimal = 66 | Char = B
Iteration: 57 | Decimal = 91 | Char = [
Iteration: 58 | Decimal = 66 | Char = B
Iteration: 59 | Decimal = 91 | Char = [
Iteration: 60 | Decimal = 66 | Char = B
Iteration: 61 | Decimal = 91 | Char = [
Iteration: 62 | Decimal = 66 | Char = B
Iteration: 63 | Decimal = 102 | Char = f
Iteration: 64 | Decimal = 91 | Char = [
Iteration: 65 | Decimal = 66 | Char = B
Iteration: 66 | Decimal = 91 | Char = [
Iteration: 67 | Decimal = 66 | Char = B
Iteration: 68 | Decimal = 91 | Char = [
Iteration: 69 | Decimal = 65 | Char = A
Iteration: 70 | Decimal = 91 | Char = [
Iteration: 71 | Decimal = 65 | Char = A
Iteration: 72 | Decimal = 91 | Char = [
Iteration: 73 | Decimal = 65 | Char = A
Iteration: 74 | Decimal = 91 | Char = [
Iteration: 75 | Decimal = 65 | Char = A
Iteration: 76 | Decimal = 91 | Char = [
Iteration: 77 | Decimal = 65 | Char = A
Iteration: 78 | Decimal = 91 | Char = [
Iteration: 80 | Decimal = 102 | Char = f
Iteration: 81 | Decimal = 91 | Char = [
Iteration: 82 | Decimal = 66 | Char = B
Iteration: 83 | Decimal = 91 | Char = [
Iteration: 84 | Decimal = 66 | Char = B
Iteration: 85 | Decimal = 91 | Char = [
Iteration: 86 | Decimal = 66 | Char = B
Iteration: 87 | Decimal = 91 | Char = [
Iteration: 88 | Decimal = 66 | Char = B
Iteration: 89 | Decimal = 91 | Char = [
Iteration: 90 | Decimal = 66 | Char = B
Iteration: 91 | Decimal = 91 | Char = [
Iteration: 92 | Decimal = 66 | Char = B
Iteration: 93 | Decimal = 91 | Char = [
Iteration: 94 | Decimal = 66 | Char = B
Iteration: 95 | Decimal = 91 | Char = [
Iteration: 96 | Decimal = 66 | Char = B
Iteration: 97 | Decimal = 91 | Char = [
Iteration: 98 | Decimal = 65 | Char = A
Iteration: 99 | Decimal = 91 | Char = [
Iteration: 100 | Decimal = 65 | Char = A
Iteration: 101 | Decimal = 91 | Char = [
Iteration: 102 | Decimal = 65 | Char = A
Iteration: 103 | Decimal = 91 | Char = [
Iteration: 104 | Decimal = 65 | Char = A
Iteration: 105 | Decimal = 91 | Char = [
Iteration: 106 | Decimal = 65 | Char = A
Iteration: 107 | Decimal = 91 | Char = [
Iteration: 108 | Decimal = 65 | Char = A
Iteration: 109 | Decimal = 102 | Char = f
Iteration: 110 | Decimal = 91 | Char = [
Iteration: 111 | Decimal = 65 | Char = A
Iteration: 112 | Decimal = 91 | Char = [
Iteration: 113 | Decimal = 65 | Char = A
Iteration: 115 | Decimal = 66 | Char = B
Iteration: 116 | Decimal = 91 | Char = [
Iteration: 117 | Decimal = 66 | Char = B
Iteration: 118 | Decimal = 91 | Char = [
Iteration: 120 | Decimal = 91 | Char = [
Iteration: 121 | Decimal = 66 | Char = B
Iteration: 122 | Decimal = 91 | Char = [
Iteration: 123 | Decimal = 66 | Char = B
Iteration: 124 | Decimal = 91 | Char = [
Iteration: 125 | Decimal = 66 | Char = B
Iteration: 126 | Decimal = 91 | Char = [
Iteration: 127 | Decimal = 66 | Char = B
Iteration: 128 | Decimal = 91 | Char = [
Iteration: 129 | Decimal = 66 | Char = B
Iteration: 130 | Decimal = 91 | Char = [
Iteration: 131 | Decimal = 66 | Char = B
Iteration: 132 | Decimal = 91 | Char = [
Iteration: 133 | Decimal = 66 | Char = B
Iteration: 134 | Decimal = 91 | Char = [
Iteration: 135 | Decimal = 65 | Char = A
Iteration: 136 | Decimal = 91 | Char = [
Iteration: 137 | Decimal = 65 | Char = A
Iteration: 138 | Decimal = 102 | Char = f
Iteration: 139 | Decimal = 91 | Char = [
Iteration: 140 | Decimal = 65 | Char = A
Iteration: 141 | Decimal = 91 | Char = [
Iteration: 142 | Decimal = 65 | Char = A
Iteration: 143 | Decimal = 91 | Char = [
Iteration: 144 | Decimal = 65 | Char = A
Iteration: 145 | Decimal = 91 | Char = [
Iteration: 146 | Decimal = 65 | Char = A
Iteration: 147 | Decimal = 91 | Char = [
Iteration: 148 | Decimal = 65 | Char = A
Iteration: 149 | Decimal = 91 | Char = [
Iteration: 150 | Decimal = 65 | Char = A
Iteration: 152 | Decimal = 65 | Char = A
Iteration: 153 | Decimal = 91 | Char = [
Iteration: 154 | Decimal = 65 | Char = A
Iteration: 155 | Decimal = 91 | Char = [
Iteration: 157 | Decimal = 91 | Char = [
Iteration: 158 | Decimal = 66 | Char = B
Iteration: 159 | Decimal = 91 | Char = [
Iteration: 160 | Decimal = 66 | Char = B
Iteration: 161 | Decimal = 91 | Char = [
Iteration: 162 | Decimal = 66 | Char = B
Iteration: 163 | Decimal = 91 | Char = [
Iteration: 164 | Decimal = 66 | Char = B
Iteration: 165 | Decimal = 91 | Char = [
Iteration: 166 | Decimal = 66 | Char = B
Iteration: 167 | Decimal = 91 | Char = [
Iteration: 168 | Decimal = 66 | Char = B
Iteration: 169 | Decimal = 91 | Char = [
Iteration: 170 | Decimal = 66 | Char = B
Iteration: 171 | Decimal = 91 | Char = [
Iteration: 172 | Decimal = 66 | Char = B
Iteration: 173 | Decimal = 91 | Char = [
Iteration: 174 | Decimal = 66 | Char = B
Iteration: 175 | Decimal = 91 | Char = [
Iteration: 176 | Decimal = 66 | Char = B
Iteration: 177 | Decimal = 91 | Char = [
Iteration: 178 | Decimal = 66 | Char = B
Iteration: 179 | Decimal = 91 | Char = [
Iteration: 180 | Decimal = 65 | Char = A
Iteration: 181 | Decimal = 91 | Char = [
Iteration: 182 | Decimal = 65 | Char = A
Iteration: 183 | Decimal = 102 | Char = f
Iteration: 184 | Decimal = 91 | Char = [
Iteration: 185 | Decimal = 65 | Char = A
Iteration: 186 | Decimal = 91 | Char = [
Iteration: 187 | Decimal = 65 | Char = A
Iteration: 188 | Decimal = 91 | Char = [
Iteration: 189 | Decimal = 65 | Char = A
Iteration: 190 | Decimal = 91 | Char = [
Iteration: 191 | Decimal = 65 | Char = A
Iteration: 192 | Decimal = 91 | Char = [
Iteration: 193 | Decimal = 65 | Char = A
Iteration: 194 | Decimal = 91 | Char = [
Iteration: 195 | Decimal = 65 | Char = A
Iteration: 196 | Decimal = 91 | Char = [
Iteration: 197 | Decimal = 65 | Char = A
Iteration: 198 | Decimal = 91 | Char = [
Iteration: 199 | Decimal = 65 | Char = A
Iteration: 200 | Decimal = 91 | Char = [
Iteration: 201 | Decimal = 65 | Char = A
Iteration: 202 | Decimal = 91 | Char = [
Iteration: 203 | Decimal = 65 | Char = A
Iteration: 204 | Decimal = 91 | Char = [
Iteration: 205 | Decimal = 66 | Char = B
Iteration: 206 | Decimal = 91 | Char = [
Iteration: 207 | Decimal = 66 | Char = B
Iteration: 208 | Decimal = 91 | Char = [
Iteration: 209 | Decimal = 66 | Char = B
Iteration: 210 | Decimal = 91 | Char = [
Iteration: 211 | Decimal = 66 | Char = B
Iteration: 212 | Decimal = 91 | Char = [
Iteration: 213 | Decimal = 66 | Char = B
Iteration: 214 | Decimal = 91 | Char = [
Iteration: 215 | Decimal = 66 | Char = B
Iteration: 216 | Decimal = 91 | Char = [
Iteration: 217 | Decimal = 66 | Char = B
Iteration: 218 | Decimal = 91 | Char = [
Iteration: 219 | Decimal = 66 | Char = B
Iteration: 220 | Decimal = 91 | Char = [
Iteration: 221 | Decimal = 66 | Char = B
Iteration: 222 | Decimal = 91 | Char = [
Iteration: 223 | Decimal = 66 | Char = B
Iteration: 224 | Decimal = 91 | Char = [
Iteration: 225 | Decimal = 66 | Char = B
Iteration: 226 | Decimal = 91 | Char = [
Iteration: 227 | Decimal = 66 | Char = B
Iteration: 228 | Decimal = 102 | Char = f
Iteration: 229 | Decimal = 91 | Char = [
Iteration: 230 | Decimal = 65 | Char = A
Iteration: 231 | Decimal = 91 | Char = [
Iteration: 232 | Decimal = 65 | Char = A
Iteration: 233 | Decimal = 91 | Char = [
Iteration: 234 | Decimal = 65 | Char = A
Iteration: 235 | Decimal = 91 | Char = [
Iteration: 236 | Decimal = 65 | Char = A
Iteration: 237 | Decimal = 91 | Char = [
Iteration: 238 | Decimal = 65 | Char = A
Iteration: 239 | Decimal = 91 | Char = [
Iteration: 240 | Decimal = 65 | Char = A
Iteration: 241 | Decimal = 91 | Char = [
Iteration: 242 | Decimal = 65 | Char = A
Iteration: 243 | Decimal = 91 | Char = [
Iteration: 244 | Decimal = 65 | Char = A
Iteration: 245 | Decimal = 91 | Char = [
Iteration: 246 | Decimal = 65 | Char = A
Iteration: 247 | Decimal = 91 | Char = [
Iteration: 248 | Decimal = 65 | Char = A
Iteration: 249 | Decimal = 91 | Char = [
Iteration: 250 | Decimal = 66 | Char = B
Iteration: 251 | Decimal = 91 | Char = [
Iteration: 252 | Decimal = 66 | Char = B
Iteration: 253 | Decimal = 91 | Char = [
Iteration: 254 | Decimal = 66 | Char = B
Iteration: 255 | Decimal = 91 | Char = [
Iteration: 256 | Decimal = 66 | Char = B
Iteration: 257 | Decimal = 91 | Char = [
Iteration: 258 | Decimal = 66 | Char = B
Iteration: 259 | Decimal = 91 | Char = [
Iteration: 260 | Decimal = 66 | Char = B
Iteration: 261 | Decimal = 91 | Char = [
Iteration: 262 | Decimal = 66 | Char = B
Iteration: 263 | Decimal = 91 | Char = [
Iteration: 264 | Decimal = 66 | Char = B
Iteration: 265 | Decimal = 91 | Char = [
Iteration: 266 | Decimal = 66 | Char = B

Received Message:
f[B[B[B[B[B[Bf[A[A[A[Af[B[B[B[B[B[Bf[A[A[A[A[A[A[B[B[B[Bf[B[B[A[A[A[A[A[Af[B[B[B[B[B[B[B[B[A[A[A[A[A[Af[A[A[B[B[B[B[B[B[B[B[B[B[A[Af[A[A[A[A[A[A[A[A[B[B[B[B[B[B[B[B[B[B[B[B[A[Af[A[A[A[A[A[A[A[A[A[A[B[B[B[B[B[B[B[B[B[B[B[Bf[A[A[A[A[A[A[A[A[A[A[B[B[B[B[B[B[B[B[B
Size:260



------ CALL TO read(), returned value: 65535

Iteration: 0 | Decimal = 66 | Char = B
Invalid protocol option received

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.