Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added padding function #75

Merged
merged 4 commits into from
Aug 11, 2023
Merged

Added padding function #75

merged 4 commits into from
Aug 11, 2023

Conversation

iamnoooob
Copy link
Contributor

@iamnoooob iamnoooob commented Aug 11, 2023

Adding a padding function, in some cases helper functions such as repeat(...) will work. However, an example use-case would be the dynamic value of {{interactsh-url}} which will change in length. In many cases, the length of the exploit payload matters (deserialization/binary data), and this comes in handy so you don't have to also modify the length field in your payload and instead directly use {{interactsh-url}} with some padding.

Example Usage:
pads('Test String','A',50) // will pad "Test String" up to 50 characters with "A" as padding byte.
Outputs:
"Test StringAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"

pads('{{interactsh-url}}/?','{{randstr}}',80) // will pad upto 80 chars of random string to adjust with the dynamic interactsh-url value everytime

Outputs:
1st Run: cjb3torug2jsnkiu13n0yqj3d3rnztn4f.oast.pro/?ikb1ZPxMoV2TqEqe04vtV1QeT68ikb1ZPxMo
2nd Run: cjb405jug2jsq2qdik70q1huj8mmkgwon.oast.online/?g66BX4W2TqFTNiiUkWGoLeS9obVg66BX4

Overall length always remains the same as specified in the last argument.

Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm !

@ehsandeep ehsandeep merged commit 4bde0f5 into projectdiscovery:main Aug 11, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants