Giter VIP home page Giter VIP logo

asm.sh's Introduction

asm.sh

This is a zero-dependency framework for embedding (somewhat) portable inline assembly directly inside bash.

At a basic level, it works by spraying shellcode inside /proc/$$/mem. From there, you can do things that you normally can't. Here are a few examples:

Print "hello"

run_shellcode "48b801010101010101015048b869646d6d6e0b0101483104244889e66a015f6a065a6a01580f05"

Run inline assembly (intel)

__asm <<EOF
pop rdi
pop rsi
pop rbp
pop rbx
pop rbx
pop rdx
pop rcx
pop rax
xor rsp, rsp
jmp rsp
EOF

Run inline C

__c <<EOF
int main(){
    write(1,"test\n",5);
}
EOF

Using mkpage, you can pass data from C directly to bash variables

Note: inline asm and inline C require pwntools asm and ragg2/clang to be installed, respectively. The asmpp preprocessor is provided to have those dependencies not required at runtime

Run any linux system call

malloc 5 "$(echo "test" | xxd -p)"
syscall $__NR_write $STDOUT_FILENO $ptr 5

In all these examples, the injected code runs as the main process, meaning you can do things much faster and access the shell's memory directly. It also means your entire shell will crash if you mess up

Installation

git clone https://github.com/CoolElectronics/asm.sh
cd asm.sh
make install

Usage

Once installed, in any shell you can run source asm.sh. Make sure to run asm_init before running any commands.

Alternatively, you can grab the entire asm.sh from releases and include it inside your bash script if you don't want to manage dependencies.

Only amd64 is supported currently. ksh is supported but can be buggy sometimes. It may segfault instantly on your machine, i'm not entirely sure why

asm.sh's People

Contributors

velzie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.