
下面我从技术原理和流程给你说一下这个东西是怎么一回事儿
为了模拟,我在本地搭建了服务器环境,展示一个正常网站如何被攻击。
首先修改电脑本地host文件。改了之后就可以用http://test.com虚拟域名访问本地文件了。文件目录在“C:\Windows\System32\drivers\etc”
网站目录很简单,如下:
在网站入口中,引用了数据库配置文件,然后输出一句话来模拟网站首页。
在数据库配置文件中,我参照当前流行的框架ThinkPHP数据库配置文件,返回一个数据库基本信息数组,包括数据库的端口和密码。
接下来就是我们的重头戏,黑客后门文件。
你可能会觉得,就这?就这几行代码能干什么?
我们访问一下我们的网站
网站可以正常访问,没有任何问题
访问一下黑客文件,好像也没有问题
现在黑客已经知道你后台php版本,装了那些插件,数据库用的是什么数据库
可以跳转到 百度了,这表示,黑客已经搭好了一个运行代码的环境。现在通过你的网站,已经可以随便写一行代码都可以执行了
已经把你的密码什么的都弄到手了,你的网站什么数据,都可以修改了,怕不怕。甚至可以“删库跑路”!!
看:1.txt文件被删除了
这就可以删除你网站上的文件了
不知道你有没有听过这么一句话,没有绝对安全的系统
这个世界上没有绝对安全的防御,只要你想
就是时间和成本的问题了
关于网站入侵,简单分享到这里,如果对这方面技术感兴趣的小伙伴,可以参考下图找我交流
import java.io.*;
import java.util.*;
public class CalcWeightAndDoc {
//这三个常量是训练文章的存储的地方
private final String positiveArticlePath = "/home/geekgao/practice/positive";
private final String negativeArticlePath = "/home/geekgao/practice/negative";
private final String unsureArticlePath = "/home/geekgao/practice/unsure";
//这两个是词典的位置
private final String posiDictPath = "/home/geekgao/朴素贝叶斯/台湾大学情感词典/ntusd-positive.txt";
private final String negaDictPath = "/home/geekgao/朴素贝叶斯/台湾大学情感词典/ntusd-negative.txt";
private Map<String,Integer> positiveWord;//存储积极词汇的map
private Map<String,Integer> negativeWord;//存储消极词汇的map
private Map<String,Integer> unsureWord;//存储不确定词汇的map
//这两个存储词典中的词语
private Set<String> positiveDict;
private Set<String> negativeDict;
//需要的全局变量
private boolean isGroup = false;
String strTemp;//从xml文件解析词语时用到的临时变量
public static void main(String[] args) {
new CalcWeightAndDoc().launch();
}
public void launch() {
positiveDict = new HashSet<String>();
negativeDict = new HashSet<String>();
readEmotionWord(positiveDict,posiDictPath);
readEmotionWord(negativeDict,negaDictPath);
//这里两个地址是目标地址,生成的文件就在下面两个地址里
calcDoc("/home/geekgao/doc.xml");
calcWeight("/home/geekgao/weight.xml");
System.out.println("执行完毕!");
}
public void readEmotionWord(Set<String> Dict, String dictPath) {
File file = new File(dictPath);
BufferedReader reader = null;
try {
String t;
reader = new BufferedReader(new FileReader(file));
while ((t = reader.readLine()) != null) {
Dict.add(t);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
}
}
}
}
