Linux shellcode sample
Linux shellcode sample
HelloWorld.nasm
;HelloWorld.asm
;Author: Kul Subedi global _start section .text
_start:
; print HelloWorld! in screen
mov eax, 0x4
mov ebx, 0x1
mov ecx, message
;mov edx, 12
mov edx, mlen
int 0x80 ; exit program gracefully
mov eax, 0x1
mov ebx, 0x5
int 0x80 section .data
message: db "Welcome to Assembly!"
mlen equ $-message
abc.nasm
;hello.asm
[SECTION .text] global _start _start: jmp short call_shellcode shellcode: xor eax, eax ;clean up the registers
xor ebx, ebx
xor edx, edx
xor ecx, ecx mov al, 4 ;syscall write
mov bl, 1 ;stdout is 1
pop ecx ;get the address of the string from the stack
mov dl, 5 ;length of the string
int 0x80 xor eax, eax
mov al, 1 ;exit the shellcode
xor ebx,ebx
int 0x80 call_shellcode:
call shellcode ;put the address of the string on the stack
db 'milu'
compile.sh
#!/usr/bin/env bash echo '[+] Assembling with Nasm .. '
nasm -f elf32 -o $1.o $1.nasm
echo '[+] Linking ... '
ld -o $1 $1.o
echo '[+] Done!'
shel.sh
#!/usr/bin/env bash objdump -d $1 | grep '[0-9a-f]:' | grep -v 'file' | cut -d: -f2|cut -d' ' -f1-6 | tr -s ' ' | tr '\t' ' ' | sed 's/ $//g' | sed 's/ /\\x/g' | paste -d '' -s | sed 's/^/"/' | sed 's/$/"/g'
abctxt.txt
"\xeb\x19\x31\xc0\x31\xdb\x31\xd2\x31\xc9\xb0\x04\xb3\x01\x59\xb2\x05\xcd\x80\x31\xc0\xb0\x01\x31\xdb\xcd\x80\xe8\xe2\xff\xff\xff\x6d\x69\x6c\x75"
shellcode.c
#include <stdio.h>
#include <string.h> unsigned char code[] ="\xeb\x19\x31\xc0\x31\xdb\x31\xd2\x31\xc9\xb0\x04\xb3\x01\x59\xb2\x05\xcd\x80\x31\xc0\xb0\x01\x31\xdb\xcd\x80\xe8\xe2\xff\xff\xff\x6d\x69\x6c\x75"; main(){
printf("Shellcode Length: %d\n", strlen(code)); int (*ret)() = (int(*)())code; ret();
}
gcc_compile.sh
#!/usr/bin/env bash echo '[+] Compiling....' gcc -fno-stack-protector -z execstack $1.c -o $1 echo '[+] Done...'
============== End
Linux shellcode sample的更多相关文章
- Linux Rootkit Sample && Rootkit Defenser Analysis
目录 . 引言 . LRK5 Rootkit . knark Rootkit . Suckit(super user control kit) . adore-ng . WNPS . Sample R ...
- 二进制入门-打造Linux shellcode基础篇
0x01 前言 本文的目的不是为了介绍如何进行恶意的破坏性活动,而是为了教会你如何去防御此类破坏性活动,以帮助你扩大知识范围,完善自己的技能,如有读者运用本文所学技术从事破坏性活动,本人概不负责. ...
- linux ps sample
ps -ef|grep "myswooleserver.php"| grep -v "grep" | wc -l cpc@cpc-Aspire-:~/Downl ...
- Linux下shellcode的编写
Linux下shellcode的编写 来源 https://xz.aliyun.com/t/2052 EdvisonV / 2018-02-14 22:00:42 / 浏览数 6638 技术文章 技 ...
- 使用MSF打造各种ShellCode
MSF 生成各种后门 Windows: 生成Windows后门. msfvenom -a x86 --platform Windows -p windows/meterpreter/reverse_t ...
- 写一个简单的shellcode
0x00 前言 漏洞利用中必不可缺的部分就是shellcode,不会编写shellcode和咸鱼有什么区别,跳出咸鱼第一步. 0x01 系统调用 通过系统调用execve函数返回shell C语言实现 ...
- shellcode编写
shellcode编写 shellcode是一段用于利用软件漏洞而执行的代码,通常使用机器语言编写,其目的往往是让攻击者获得目标机器的命令行shell而得名,其他有类似功能的代码也可以称为shellc ...
- Linux 驱动开发
linux驱动开发总结(一) 基础性总结 1, linux驱动一般分为3大类: * 字符设备 * 块设备 * 网络设备 2, 开发环境构建: * 交叉工具链构建 * NFS和tftp服务器安装 3, ...
- 3.10.17 procfs示例
/* * wesley * the linux module sample of procfs * * wesley for testing * 2013-12-23 ...
随机推荐
- excel中如何设置只打印第一页
在打印表格时,怎样设置只打印第一页呢,操作很简单,下面,小编说下操作方法. 方法/步骤 打开要打印的工作表, 再点击“文件” 弹出的页面中,在左侧这里,点击“打印” 在右边弹出与打 ...
- P4138 [JOISC2014]挂饰
P4138 [JOISC2014]挂饰 ◦ N个装在手机上的挂饰.挂饰附有可以挂其他挂件的挂钩.每个挂件要么直接挂在手机上,要么挂在其他挂件的挂钩上.直接挂在手机上的挂件最多有1个. ...
- html添加注释怎么弄?
HTML 注释: <!--这是一段注释.注释不会在浏览器中显示.--> 这是一段普通的段落. 快捷键: 我用的是 Notpad++ 添加行注释 Ctrl+K 取消行注释 Ctrl+Shif ...
- Oracle 性能之 Enq: CF - contention
Oracle 性能之 Enq: CF - contention Table of Contents 1. 原因 2. 解决问题 2.1. 针对持有锁进程类型处理 2.1.1. 查看持有锁会话的进程类型 ...
- 自定义application的全局捕获异常实现
package com.loaderman.global; import android.app.Application; import android.os.Environment; import ...
- AndroidManifest.xml中的<uses-feature>以及和<uses-permission>之间的联系
概述:<uses-feature>用来声明应用中需要用的硬件和软件的功能. 硬件特性:表明您的应用需要用的硬件功能. 功能类型 特征描述 描述 音频 android.hardware.au ...
- 运维之思科篇——NAT基础配置
一. NAT(网络地址转换) 1. 作用:通过将内部网络的私有IP地址翻译成全球唯一的公网IP地址,使内部网络可以连接到互联网等外部网络上. 2. 优点: 节省公有合法IP地址 处理地址重叠 增强灵活 ...
- [Python]python-jenkins获取正在构建中的job
需求: 我现在需要完成1个接口,这个接口会启动jenkins构建jobA, jobA构建结束, 返回job的构建结果 思路: 首先使用get_job_info获取最后1次构建的构建序号,然后再通过ge ...
- 浅谈JS中 reduce() 的用法
过去有很长一段时间,我一直很难理解 reduce() 这个方法的具体用法,平时也很少用到它.事实上,如果你能真正了解它的话,其实在很多地方我们都可以用得上,那么今天我们就来简单聊聊JS中 reduce ...
- php composer 开发自己的包
以往都是在项目直接写自己的包文件,并没有把他放在packagist上面,以composer来管理使用. 今天没事来整一下,供大家一起学习 一,在github和packagist分别注册自己的账号,这里 ...