JAVA开发--U盘EXE恢复工具
2015-10-20 18:01
555 查看
原理比较简单,在学校机房U盘总被感染,写一个工具来方便用
package com.udiskrecover; import java.awt.Container; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.text.AbstractDocument.Content; /* ############################################################ # # # 【名称】 : U盘EXE恢复工具 # # 【作者】 : Sevck(一个写代码很帅的男人) # # 【团队】 : 网络尖刀 # # 【主页】 : http://sevck.lofter.com # # 【日期】 : 2015-10-15 # # 【功能】 : 将磁盘上病毒引起的感染EXE通过DOS恢复 # # # ############################################################ # ┏┓ ┏┓ #┏┛┻━━━┛┻┓ #┃ ┃ #┃ ━ ┃ #┃ ┳┛ ┗┳ ┃ #┃ ┃ #┃ ``` ┻ ```┃ #┃ ┃ #┗━┓ ┏━┛ #####┃ ┃Code is far away from bug with the animal protecting. #####┃ ┃神兽护佑,代码无Bug. #####┃ ┗━━━━━┓ #####┃ ┣┓ #####┃ ┏┛ #####┗┓┓┏━┳┓┏┛ #######┃┫┫ ┃┫┫ #######┗┻┛ ┗┻┛ ############################################################ */ public class UDiskRecover extends JFrame { JLabel label; JTextField text; JButton submit; String reg = "[a-zA-Z]{1}"; public UDiskRecover() { init(); } public void init() { Container cp = this.getContentPane(); label = new JLabel("请输入要恢复的磁盘:"); text = new JTextField(10); submit = new JButton("确定"); cp.add(label); cp.add(text); cp.add(submit); this.setSize(300, 200); this.setVisible(true); this.setDefaultCloseOperation(3); //this.setLocationRelativeTo(null); this.setTitle("U盘EXE恢复工具--By:Sevck"); this.setLayout(new FlowLayout(1, 20, 30)); this.setResizable(false); submit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub String content = text.getText(); boolean z = content.matches(reg); Process process = null; if (z) { String cmd = "cmd.exe /c attrib -s -h -r " + content + ":\\\\* /s /d"; // String cmd="cmd.exe /c move d:\\1.txt e:\\"; // String cmd="cmd.exe /c move d:\\1.txt e:\\"; // System.out.println(newcon); // System.out.println(cmd); try { process = Runtime.getRuntime().exec(cmd); System.out.println(process.toString()); JOptionPane.showMessageDialog(null, "文件恢复成功!"); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); JOptionPane.showMessageDialog(null, "文件恢复失败!"); } } else { JOptionPane.showMessageDialog(null, "请输入正确的盘符!\r\n提示:a-z||A-Z,不需要写“:”."); } } }); } public static void main(String[] args) { new UDiskRecover(); } }
相关文章推荐
- 修改Spring-task 定时时间
- MyEclipse使用JAX-WS 2.0生成WebService报错,无法生成WSDL文件
- Spring配置事务切面
- javaweb之Java基础加强
- 【dubbo源码解读系列】之一 使用eclipse调试dubbo源代码
- JS以及Java防止数据重复提交
- Java读取Properties文件的六种方法
- Java设计模式---原型模式(Prototype)
- Java设计模式---原型模式(Prototype)
- gradle --refresh-dependencies cleanEclipse eclipse
- eclipse项目导入的问题
- 在Ubuntu中安装Eclipse与Helloworld
- java中static作用详解
- Java: 复制文件最快方法
- <学习笔记>Spring Security 学习
- java 自动装箱与拆箱 || java中 == 与 equal 的区别
- struts1.2中<action>parameter属性问题
- Java解析XML与生成XML文件
- Java解析XML与生成XML文件
- JavaWeb扩展--Freemarker