Giter Club home page Giter Club logo

p2p-hash's Introduction

Hash cracking in peer-to-peer architecture

Description

This repository contains implementation of PoC (Proof of Concept) peer-to-peer network for simplified hash cracking.

It consist of few processes and utility script for generating file for cracking. Main process manages communication between peers and connection between other two processes (worker process and server process). Depending on in which state the peer is (at the moment, the best overview of those states is to read the code in state module) behaviour of the peer changes and adapts to other peers in the network.

Worker process is only for finding plaintext of given hash (and method). Currently it supports MD5, SHA1, SHA256 but it can be easily changed to support even more algorithms.

Server process connects to main process and fetches information about current state of hash cracking. It also provides web interface for viewing all the information.

Installation

npm install
npm run dev

The npm run dev watches entrypoints and creates files in /build. If you would like to add new entrypoint to watch and build just edit:

entry: {
  server: path.resolve(__dirname, '../src/Server.ts')
}

in /config/webpack.config.js by adding another line.

For example:

entry: {
  server: path.resolve(__dirname, '../src/server/main.ts'),
  something: path.resolve(__dirname, '../src/something.ts'
}

will watch file /src/something.ts and compile it to /build/something.js.

Docker

The project uses Docker for setting up example network. You will need to create your own Docker machine with shared folder pointing to directory of the project (convenient for live code updates).

To start the network:

docker-compose up

If you want to change number of peers you will need to tweak the docker-compose.yml file. The package.json file is also worth checking because of default definitions of npm shortcut commands.

How to launch something?

In /build there should be files you are looking for. If you want to start your application just type node <name_of_file.js> and thats it.

Issues and limitations

Current implementation of this project is limited only to the local network - all of the peers must be inside of the same network. There is also problem with changing length of words to check the hashes against to. Right now, it is hardcoded inside of the WorkerState.ts.

p2p-hash's People

Contributors

bluebears-dev avatar asozanska avatar sciemniak000 avatar

p2p-hash's Issues

Create worker application

Other processes should be able to spawn a worker process with parameter (list of hashes).

The worker should choose appropriate strategy given the hash (if its 256-bit hash, go with 256-bit hashing algorithms). This is a place for Strategy Pattern. For example, Hash256Strategy will consist of few or several other strategies that will be launched (there are several algorithms that outputs 256-bit hashes). There might be a case that no implemented strategy is correct, then it should just return None for that hash.
The worker also will have to use the Iterator pattern for hash cracking.

When finished, it should return the results to the parent process and exit.

Create random hash generator application

Hash generator should be an application. It could accept as parameters: a number of hashes to generate, how many symbols are expected in a string (the string which will produce hash) and output filename.

It should be easier to use existing Iterator pattern. Create something like RandomStringIterator and RandomString (this class will return the iterator).

You can choose hashes randomly for the string, but make it elastic. We might need to adjust which hashing algorithms we use (it can be hardcoded in some array).

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.