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 ...
随机推荐
- 黑马vue---13、事件修饰符的介绍
黑马vue---13.事件修饰符的介绍 一.总结 一句话总结: .stop 阻止冒泡:input type="button" value="戳他" @click ...
- Mybatis多值传递的方式
一共有三种方式 1.参数传入Map 2参数使用@params 3.直接使用时用#{0},#{2} 参考网址 :https://www.2cto.com/database/201409/338155.h ...
- 微服务一键启动脚本shell没有环境变量的
#!/bin/bash#######################################################export JAVA_HOME=/root/data/app/jd ...
- 九、封装登录POST请求、登录后POST请求以及GET请求
一.封装登录后POST请求以及GET请求 /** * 全局运行时环境参数管理器 */ public static Map<String, String> BASE_GLOBAL_MAP; ...
- RN性能优化(重新探索react吧)
最近做RN遇到了一些性能瓶颈,逼着自己不得不做一些优化 已经做过,或者尝试过得优化方案: 1.点击效果防止重复点击. 2.左右两边分别用两个异步栈进行更新,这样能让右边的缓慢不影响左边的更新. 3.I ...
- 数据库开源框架之litepal
主页: [https://github.com/LitePalFramework/LitePal](https://github.com/LitePalFramework/LitePal) 中文文档地 ...
- 吐血整理,一文读懂中国金融衍生品市场的前世今生和未来[z]
[z]https://www.gfedu.cn/cfrm/content_22687.shtml 从定义上来说,金融衍生工具(derivativesecurity)是在货币.债券.股票等传统金融工具的 ...
- Numpy数据类型转化astype,dtype
1. 查看数据类型 import numpy as np arr = np.array([1,2,3,4,5]) print(arr) [1 2 3 4 5] # dtype用来查看数据类型 arr. ...
- 【巨坑】springmvc 输出json格式数据的几种方式!
最近公司项目需要发布一些数据服务,从设计到实现两天就弄完了,心中窃喜之. 结果临近部署时突然发现..... 服务输出的JSON 数据中 date 类型数据输出格式要么是时间戳,要么是 {&quo ...
- python对列表中名字进行修改,在每个名字后面加入‘the Great’
第一种方法:使用enumerate函数 def make_great(magicians): for i ,name in enumerate(magicians): magicians[i] = m ...