吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 3175|回复: 2
收起左侧

[其他原创] 【原创源码】病毒留下的空白

[复制链接]
cghy122 发表于 2016-6-6 10:43
本帖最后由 奋斗丶小Z 于 2016-6-6 14:26 编辑

RemoveBug.rar (521.12 KB, 下载次数: 3)
最近电脑全部的html文件被写入了一种VB脚本,昨晚用数字杀毒杀了一晚上,早上起来看,文件里原来VB脚本的位置全部变成了空白,占了不少系统的内存,自己写了个遍历文件夹获取html文件进行替换,写的不好,拿出来献献丑,用的是java写的,直接贴源代码,也打了包
[Java] 纯文本查看 复制代码
package com.remove.main;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.List;

public class Main {
        public static void main(String[] args) {
                new Thread(new Runnable() {
                        
                        @Override
                        public void run() {
                                listFile("D:\\apache-tomcat-7.0.68");
                        }
                        private void listFile(String path){
                                File file=new File(path);
                                String[] strs={"PerfLogs","MSOCache","System Volume Information","Config.Msi","Documents and Settings"};
                                List<String> list=Arrays.asList(strs);
                                if(file.exists() /*&& !file.getName().contains("-")*/ && !list.contains(file.getName())){
                                        File[] files=file.listFiles(new FileFilter() {
                                                @Override
                                                public boolean accept(File pathname) {
                                                        String fileName=pathname.getName();
                                                        if(pathname.isDirectory() || (fileName.endsWith("htm") || fileName.endsWith("html"))){
                                                                return true;
                                                        }
                                                        return false;
                                                }
                                        });
                                        if(files==null){
                                                System.out.println(file.getName());
                                        }
                                        if(files.length==0){
                                                return;
                                        }else{
                                                for(File fi:files){
                                                        if(fi.isDirectory()){
                                                                listFile(fi.getAbsolutePath());
                                                        }else{
                                                                read(fi.getAbsolutePath());
                                                        }
                                                }
                                        }
                                }
                        }
                        public String codeString(String fileName) throws Exception{
                                BufferedInputStream bin = new BufferedInputStream(
                                new FileInputStream(fileName));
                                int p = (bin.read() << 8) + bin.read();
                                bin.close();
                                String code = null;
                                
                                switch (p) {
                                        case 0xefbb:
                                                code = "UTF-8";
                                                break;
                                        case 0xfffe:
                                                code = "Unicode";
                                                break;
                                        case 0xfeff:
                                                code = "UTF-16BE";
                                                break;
                                        default:
                                                code = "GBK";
                                }
                                
                                return code;
                        }
                        public void read(String path){
                                BufferedReader br=null;
                                BufferedWriter bw=null;
                                StringBuilder sb=null;
                                try {
                                        String code=codeString(path);
                                        br=new BufferedReader(new InputStreamReader(new FileInputStream(path),code ));
                                        sb=new StringBuilder();
                                        String line=null;
                                        while((line=br.readLine())!=null){
                                                sb.append(line+"\r\n");
                                        }
                                        String value=sb.toString();
                                        value.replace(value, "\n"+" ");
                                        value=value.trim();
                                        value=value.substring(0, value.indexOf("</html>")+7);
                                        value.trim();
                                        bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path)));
                                        bw.write(value);
                                        System.out.println(path);
                                        bw.flush();
                                } catch (Exception e) {
                                        e.printStackTrace();
                                }finally{
                                        if(br!=null){
                                                try {
                                                        br.close();
                                                } catch (IOException e) {
                                                        // TODO Auto-generated catch block
                                                        e.printStackTrace();
                                                }
                                        }
                                        if(bw!=null){
                                                try {
                                                        bw.close();
                                                } catch (IOException e) {
                                                        // TODO Auto-generated catch block
                                                        e.printStackTrace();
                                                }
                                        }
                                }
                        }
                }).start();
        }
}





发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

azusys 发表于 2016-6-7 08:49
这不是我之前中过的病毒么
MAXtoDEATH 发表于 2016-6-10 20:29
可以的,大数字杀lnk可能吃力正常。。。之前我也写过的vb下的lnk病毒,当然你为什么不用vb写去对vbs病毒呢23333
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-9-23 09:30

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表