0x00 前言

pwn脚本千篇一律,之前也是保存了一份模板,每次都用它,但还是觉得每次都复制一次各种名字还是有的累,于是就写了一份脚本生成器

0x01 ScriptMaker

#!/usr/bin/env python
# coding: UTF-8
import sys
from sys import * def make():
data = """
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
from pwn import *
import os, sys DEBUG = 1 elf = ELF('./""" + argv[1] + """') if DEBUG:
libc = ELF('/home/moonagirl/moonagirl/libc/libc_local_x64')
p = process('./""" + argv[1] + """')
context.log_level = 'debug' else:
libc = ELF('./libc-2.23.so')
www = '47.90.103.10'
port = 6000
p = remote(www,port) system_libc = libc.symbols['system']
success('system_libc:'+hex(system_libc)) def pwn():
p.interactive() if __name__ == '__main__':
pwn()
"""
py = "%s.py" % argv[1] f = open("./%s" % py, "wb")
f.write(data)
f.close() if __name__ == '__main__':
if len(sys.argv) > 1:
make()

0x02 将ScriptMaker加入系统路径

将保存ScriptMaker的路径加入到home下的.profile文件PATH中,如下图,我的路径为/moonagirl/libc/python

➜  ~ cat .profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package. # the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022 # if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi # set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$HOME/moonagirl/libc/python:$PATH"

然后重启系统就可以直接在命令台下执行ScriptMaker了,以后有什么新的需求直接修改ScriptMaker文件就行

➜  ~ ScriptMaker Test

  

ScriptMaker的更多相关文章

  1. fadora24安装settools,pip包出错解决方法

    1.fadora24安装Python2.7 [root@dev ~]# python bash: python: 未找到命令... 安装软件包“python”以提供命令“python”? [N/y] ...

随机推荐

  1. 验证您的Shell为Bash

    内容介绍 在管理Linux服务器时,命令行操作无疑是最为耗时的环节.对大多数用户而言,这意味着将大量时间用于操作Bash shell. 尽管大多数发行版都提供默认的用户类型与root prompts, ...

  2. 树形DP 洛谷P2014 选课

    洛谷P2014 选课 题目描述 在大学里每个学生,为了达到一定的学分,必须从很多课程里选择一些课程来学习,在课程里有些课程必须在某些课程之前学习,如高等数学总是在其它课程之前学习.现在有N门功课,每门 ...

  3. Collection、泛型

    Collection.泛型 Collection.泛型 Collection.泛型 Collection.泛型 Collection.泛型 Collection.泛型 Collection.泛型

  4. ES6工作中常用知识点

    好久不动笔了 第一个知识点:import 和 export import导入模块.export导出模块 //全部导入 import people from './example' //有一种特殊情况, ...

  5. JPA规范基础 ppt教程

    https://wenku.baidu.com/view/5ca6ce6a1eb91a37f1115cee.html

  6. Markdown 简单标签语言

    Markdownhttps://www.cnblogs.com/ixysy/p/6236782.html Markdown基本语法https://www.jianshu.com/p/191d1e21f ...

  7. Linux Shell命令系列(5) VI编辑器

    vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令.由于对Unix及Linux系统的任何版本,vi编辑器是完全相 ...

  8. OpenStack Cirros

    Cirros Openstack的开发,基本都使用这个image来测试,因为他比较小,只有10M. 镜像介绍 镜像的地址: https://launchpad.net/cirros/trunk/0.3 ...

  9. js中的focus()聚焦

    document.getElementById("vin").focus();document.form1.name.focus() $(document).ready(funct ...

  10. 判断两个IP地址是不是属于同一子网的方法

    一个IP地址有三种写法: 第一种,单个IP,如192.168.55.28 第二种,IP/子网掩码,如192.168.55.28/255.255.255.0 第三种,IP/子网掩码长度,如192.168 ...