Coder Social home page Coder Social logo

rarcracker's Introduction

Simple Compressed File Cracker

GitHub All Releases PyPI - Python Version PyPI PyPI - Downloads GitHub

A python based compressed file cracker

  • generate password from ASCII charset or custom charset using charset param

  • multi-thread

Install

From git

  • git clone https://github.com/hanerx/rarCracker.git

  • run pip install -r requirements.txt

  • make sure you have installed winrar or unar or bsdstar

  • run python -m rarCracker

From release

  • download file from release
  • run pip install rarCracker-0.0.1.tar.gz
  • run python -m rarCracker

From pip

  • run pip install rarCracker

Usage

Basic

from rarCracker import RarCracker
if __name__ == '__main__':
    cracker = RarCracker('file_path', 3, 3, workers=2, charset='1234567890')
    cracker.crack()

Use Local Dictionary

from rarCracker import RarCracker, LocalProvider

if __name__ == '__main__':
    cracker = RarCracker('./test.rar', provider=LocalProvider('./dict.txt'), unrar_tool='unrar')
    print(cracker.crack())

Use Network Dictionary

from rarCracker import RarCracker, NetworkProvider

if __name__ == '__main__':
    cracker = RarCracker('./test.rar', provider=NetworkProvider('https://hanerx.top/rarCracker/dict.json',
                                                                method=NetworkProvider.GET))
    print(cracker.crack())

Use Breakpoint

from rarCracker import RarCracker, LocalProvider, LocalBreakPoint

if __name__ == '__main__':
    cracker = RarCracker('./test.rar', provider=LocalProvider('./dict.txt'), unrar_tool='unrar',
                         break_point=LocalBreakPoint(breakpoint_count=1))
    print(cracker.crack())

API

RarCracker

The main class for module

params

name type desc default required
file_path str the compressed file path, if file does not exist raise FileNotFoundError , if file is not .rar or .zip raise TypeError None True
start int the minimum password length 1 False
stop int the maximum password length 10 False
charset str the password charset digits + ascii_letters + punctuation False
output str the output folder './output' False
workers int the number of multi thread 8 False
level int the logging display level logging.INFO False
unrar_tool str the decompressing tool, support unrar \ unar \ bsdtar 'unrar' False
provider Provider the password provider, if provider is not None it will replace original password generator and start \ stop \ charset will not work None False

Methods

crack()
  • The method which start cracking, will block until all threads done or password found, if crack failed it will return None

  • return None or str

generate_password()
  • The method which will return an iterator for password

  • return iter

Provider

The abstract class for provider param

Methods

generate(file)
  • The method which will return an iterator for password
  • return iter

DefaultProvider

The default password provider

Param

name type desc default required
start int the minimum password length 1 False
stop int the maximum password length 10 False
charset str the password charset digits + ascii_letters + punctuation False

Methods

generate(file)
  • The method which will return an iterator for password
  • return iter

LocalProvider

The class allows to get password from local dictionary

Param

name type desc default required
path str the dictionary file path, if file does not exist raise FileNotFoundError None True

Methods

generate(file)
  • The method which will return an iterator for password
  • return iter

NetworkProvider

The class allows to get password from network dictionary

Param

name type desc default required
url str the url of the dictionary None True
method method the method of request, support GET \ POST \ PUT \ DELETE \ OPTION \ HEAD NetworkProvider.GET False
on_decode method the decode method for response self.default_decode(result) False
**kwargs support params for requests module None False

Methods

default_decode(result)
  • The method which will decode the response by default
  • accept json format array, for example ["123","124","125"]
  • return list
generate(file)
  • The method which will return an iterator for password
  • return iter

BreakPoint

The abstract class for break_point param

Methods

generate(provider,file)
  • The method which will return a iterator for password with breakpoint supported
  • return iter

DefaultBreakPoint

The default breakpoint when break_point param is None

Methods

generate(provider,file)
  • The method which will return a iterator for password with breakpoint supported
  • return iter

LocalBreakPoint

The breakpoint will save cracking count number into local file and recover the progress from local file

Param

name type desc default required
breakpoint_path str the breakpoint file path, if file does not exist counter will start at 0 './breakpoint.txt' False
breakpoint_count int the interval between two breakpoint 1000 False

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.