Giter Club home page Giter Club logo

hlextend's Introduction

Stephen's Github

This is where I store my public code, most of which is related to my pentesting/security work.

Some of the more interesting items are:

  • My pentesting_stuff repository, which has a website with some simple writeups on niche subjects I sometimes need reminders on, and bits of code too small for their own repo to do various pentesting tasks
  • vulnserver. I wrote this ages ago, its a simple server app that helps you learn software exploitation. Its inexplicably still relatively popular. I have a blog that has some articles describing how to exploit some of the vulnerabilities.
  • breakableflask, a simple single file vulnerable web app that was designed to be used as a target for me to test exploitation tools against. Also works as a learning tool.
  • Ive written new Burp extensions, and modified existing ones in Java and Python. Many have very niche uses, but even though I dont use them very often they do serve as good examples of how to write/modify extensions yourself. Examples here, here, here, here, here, here and here.
  • This is a DNS server I wrote to facilitate the process of obtaining wildcard certificates from LetsEncrypt using the DNS01 protocol. I wanted something small and dedicated to purpose as I was running it on a system that was making several non traditional uses of DNS, including a dedicated Burp Collaborator server and a DNS tunneling service. To help route the DNS requests I also modified this to route DNS requests based on type.

hlextend's People

Contributors

iaotle avatar ir0nstone avatar stephenbradshaw avatar tjtanjin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hlextend's Issues

Bytestring return

It would be much more convenient to have the return type be a bytestring. This way we won't have to unescape the extra bytes that are added when padding.

In my code I had to do

extended_query = sha.extend('&filename=' + HIDDEN_FILE, file_query, KEY_SIZE, MAC)
extended_query = bytes(extended_query, 'utf-8').decode("unicode_escape") # unescape bytes
forged_filename = urllib.parse.quote(extended_query, safe='?&=').replace('%C2', '') # conver to url remove garbage %C2
querystring = '?' + forged_filename + '&mac=' + forged_mac # create query

Am I misunderstanding how to use your library?

Hi, I tried to use your small example in order to create a proof of concept for myself of how an attack would work.

So I made this small script:

import hlextend
import hashlib


def hash(message, secret):
    payload = secret + message
    hash_object = hashlib.sha1(bytes(payload,"utf-8"))
    return hash_object.hexdigest()


message = "hello"
secret = "secret1234"

### First, we create our own hash
print(hash(message, secret)) 

# 52e98441017043eee154a6d1af98c5e0efab055c


## We then try to make a forged hash, using length extension, where we try to append the word "file"
sha = hlextend.new('sha1')
forged = sha.extend("file", message, 10,'52e98441017043eee154a6d1af98c5e0efab055c')
print(forged)
print(sha.hexdigest())


## and now we check if our forged signature makes is correct:

print(hash(forged,secret))

But this does not work, currently, the last line is 876d8406a52c71321930e99ac44740ccaea3d080, while it should be c60fa7de0860d4048a3bfb36b70299a95e6587c9, as described in your readme
Have I misunderstoof something about how your libary works?

Crazy Q

Still trying to wrap my head around this, so apologies in advance and I appreciate anything you can toss my way! But I had 3 questions for you.

  1. If I wanted to hash "hello" with your script, how would I call that?
  2. Can your script then return the original text if I have the hashed key from (1) and the length of the text? So can I get back to 'hello'?
  3. If two is yes, how would you suggest going about it?

TypeError: 'float' object cannot be interpreted as an integer

Traceback (most recent call last):
File "hasher.py", line 5, in
data = sha.extend('O:6:"Hacker":2:{s:17:" Hacker show_flag";b:1;s:16:" Hacker username";s:10:"hacker1337";}', 'O:6:"Hacker":2:{s:17:" Hacker show_flag";b:0;s:16:" Hacker username";s:10:"hacker1337";}', 8, '367f4643e26f0820db070629f43a5e6a614d778a5f1fd68d1fe1ce2d00b3934d')
File "C:\Users\Shawn Lee\Downloads\hlextend-master\hlextend-master\hlextend.py", line 118, in extend
self.__setStartingHash(startHash)
File "C:\Users\Shawn Lee\Downloads\hlextend-master\hlextend-master\hlextend.py", line 154, in __setStartingHash
hashVals = [ int(startHash[a:a+self._b1],base=16) for a in range(0,len(startHash), self._b1) ]
TypeError: 'float' object cannot be interpreted as an integer

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.