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. [JLOI2012]树 倍增优化

    题目描述 在这个问题中,给定一个值S和一棵树.在树的每个节点有一个正整数,问有多少条路径的节点总和达到S.路径中节点的深度必须是升序的.假设节点1是根节点,根的深度是0,它的儿子节点的深度为1.路径不 ...

  2. 8、kvm虚拟机添加硬盘

    kvm虚拟机添加硬盘qemu-img创建一块新的硬盘 qemu-img create -f qcow2 /kvm-data/kvm/jumperhost_disk1.qcow2 50G 关闭虚拟机 v ...

  3. linux开机出现Give root password for maintenance (or type Control-D to continue):解决办法

    修改rc.local后导致 linux开机出现Give root password for maintenance,而且很多系统文件无法修改,之前的rc.local也不能修改了,单用户模式也无法进入 ...

  4. MD5WLBUtil

    import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; import j ...

  5. applicationContext-datasource.xml

    <?xml version="1.0" encoding="utf-8"?> <beans default-init-method=" ...

  6. Caused by: MetaException(message:Hive Schema version 2.1.0 does not match metastore's schema version 1.2.0 Metastore is not upgraded or corrupt)_2

    Caused by: MetaException(message:Hive Schema version 2.1.0 does not match metastore's schema version ...

  7. Dell 笔记本触摸板网页双指滑动黑屏

    # 问题如题 # 解决方法: -- 在网上搜了解决方法,最靠谱的一个是说,开机进BIOS,然后什么都不修改退出,重启就能解决(但是我采用这种方法并没有解决) -- 我自己的解决方法:设备管理器里面卸载 ...

  8. CountDownLatch与CyclicBarrier的使用与区别

    CountDownLatch的介绍和使用: 一个同步辅助类,在完成一组正在其他线程中执行的操作之前,它允许一个或多个线程一直等待. 用给定的计数 初始化 CountDownLatch.由于调用了 co ...

  9. 【图解】我使用过的 Dubbo 和 Spring Cloud

    自从2015年毕业开始从事 Java 开发工作,已经过去3年多了, 在各种不知名的小公司待过,经历过生产力从低到高,技术从落后到先进的过程, Dubbo 和 Spring Cloud 就是我曾经所经历 ...

  10. 关于docker下容器和宿主机器时间不一致问题

    在前几天,在阿里云的ECS上部署一个docker应用时,发现部署的应用在请求第三方应用时,一直出现超时的异常提示,刚开始以为是第三方应用系统的问题(此系统无赖躺枪,反正也不是一次两次了,多躺几次也就习 ...