Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Date;
- import java.net.*;
- import java.util.Scanner;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class honey{
- public static void main(String[] args) throws IOException, InterruptedException{
- //Declaring
- String userInput,logf,alert,loop,inputLine,outputLine,service,custom,whois,sent1,sent2,sent3,reci = null;
- ServerSocket serverSocket = null;
- PrintWriter out = null;
- String port = "1433";
- Socket clientSocket = null;
- Date date = new Date();
- String inp = null, outp;
- int attempt = 0;
- int banner = 0;
- String cmd = "whois ";
- Pattern ex = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
- Matcher match;
- //Scanning for input and creating the log
- System.out.println("# # ## \n# # ### ## ### # # # ## ### \n### # # # # ## ### # # # # \n# # ### # # ### # # # ### # \n# # ### # \nCreated By: Pathogen\n");
- Scanner scan = new Scanner(System.in);
- System.out.println("Choose port to listen on (1-1024 require root)");
- port = scan.next();
- int prt = Integer.parseInt(port.trim());
- System.out.println("Specify log filename.");
- logf = scan.next();
- System.out.println("How many connection attempts would you like to allow?");
- loop = scan.next();
- int lop = Integer.parseInt(loop.trim());
- System.out.println("What banner would you like to display to the intruder?\n(1)Gmail\n(2)Proxy\n(3)Custom Message");
- service = scan.next();
- banner = Integer.parseInt(service.trim());
- File dir = new File(logf);
- BufferedWriter fout = new BufferedWriter(new FileWriter(dir));
- //opening socket
- try{
- System.out.println("Trying to open socket");
- serverSocket = new ServerSocket(prt);
- }
- catch (IOException e){
- System.out.println("Could not listen on port " + prt + ", please try a different one.");
- port = scan.next();
- prt = Integer.parseInt(port.trim());
- serverSocket = new ServerSocket(prt);
- }catch (Exception e){
- System.out.println("Could not listen on port "+ prt + "\nClosing client.");
- }
- if (banner == 1){
- while(lop >= 0){
- InetAddress in3t = serverSocket.getInetAddress();
- System.out.println("Scan watch is now listening on port " + prt + "\nTime began - " + date +"\nLog directory - " + dir.getCanonicalPath() + "\nOption chosen: Gmailer" );
- fout.write("Scan watch is now listening on port " + prt + "\nTime began - " + date +"\nLog directory - " + dir.getCanonicalPath() + "\nOption chosen: Gmailer");
- try{
- clientSocket = serverSocket.accept();
- //Set stream reader and wrighter for sockets--------------------------------------
- PrintWriter out1 = new PrintWriter(
- clientSocket.getOutputStream(), true);
- BufferedReader in1 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
- InetAddress inet = clientSocket.getInetAddress();
- String host = inet.getCanonicalHostName();
- String hostp = inet.getHostAddress();
- System.out.println(hostp);
- alert = "\nConnection attempt by: " + host + "\n" + clientSocket + " \nTime detected - " + date + "\n";
- System.out.println(alert);
- fout.write(alert);
- //Get client info
- inet = clientSocket.getInetAddress();
- Runtime run = Runtime.getRuntime();
- Process pro = run.exec(cmd + hostp);
- pro.waitFor();
- BufferedReader buff = new BufferedReader(new InputStreamReader(pro.getInputStream()));
- String line = "";
- while((line = buff.readLine())!= null){
- System.out.println(line);
- }
- System.out.println(alert);
- out1.println("Welcome to the Anonymous Gmailer.\n Enter your login credentials to continue on.\n Username");
- inp = in1.readLine();
- System.out.println("Username: " + inp);
- fout.write("Username: " + inp);
- fout.newLine();
- out1.println(" Password");
- inp = in1.readLine();
- System.out.println("Password: " + inp + "\n\n");
- fout.write("Password: " + inp + "\n\n");
- fout.newLine();
- out1.println("Invalid username or password, try again.");
- inp = in1.readLine();
- System.out.println("Username: " + inp);
- fout.write("Username: " + inp);
- fout.newLine();
- out1.println(" Password");
- inp = in1.readLine();
- System.out.println("Password: " + inp + "\n\n");
- fout.write("Password: " + inp + "\n\n");
- out1.println("Invalid username or password, try again.");
- inp = in1.readLine();
- System.out.println("Username: " + inp);
- fout.write("Username: " + inp);
- fout.newLine();
- out1.println(" Password");
- inp = in1.readLine();
- System.out.println("Password: " + inp + "\n\n");
- fout.write("Username: " + inp + "\n\n");
- outp = "202 Error! Invalid Credentials.\nConnection closed by foriegn host";
- out1.println(outp);
- System.out.println("Connection attempt #"+ attempt);
- attempt = attempt + 1;
- }catch (IOException i){
- attempt = (attempt + 1);
- System.out.println("\nWARNING - You may be getting scanned\nAttempt #" + attempt);
- fout.write("\nWARNING - You may be getting scanned\nAttempt #" + attempt);
- } if (lop == 0){
- System.out.println("Socket Status: Closed");
- System.out.println("Connection limit reached.");
- clientSocket.close();
- serverSocket.close();
- }
- }}
- else if (banner == 2)
- {
- while(lop >= 0)
- { System.out.println("Scan watch is now listening on port " + port + "\nTime began - " + date +"\nLog dir - " + dir.getCanonicalPath() + "\nOption chosen: Proxy" );
- fout.write("Scan watch is now listening on port " + port + "\nTime began - " + date +"\nLog dir - " + dir.getCanonicalPath() + "\nOption chosen: Proxy");
- try
- { serverSocket.close();
- serverSocket = new ServerSocket(prt);
- clientSocket = serverSocket.accept();
- //----------------------------------------
- // Proxy Banner
- //----------------------------------------
- PrintWriter out11 = new PrintWriter(clientSocket.getOutputStream(), true);
- BufferedReader in11 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
- InetAddress inet = clientSocket.getInetAddress();
- String hostp = inet.getCanonicalHostName();
- Runtime run = Runtime.getRuntime();
- out11.println("########################################################\n#Welcome to the Enterprize Edition of Proxmark Proxies #\n########################################################\n");
- alert = "\nConnection attempt by: "+ hostp +"\n"+ clientSocket + " \nTime detected - " + date;
- System.out.println(alert);
- System.out.println("\nIntruders input\n_______________");
- fout.write("\nIntruders input\n_______________\n");
- fout.newLine();
- fout.write(alert);
- int run1 = 1;
- while(run1 == 1){
- if(clientSocket.isConnected()){
- try{
- inp = in11.readLine();
- System.out.println(inp);
- fout.write(inp);
- fout.newLine();
- }catch (Exception ee){
- lop = lop - 1;
- System.out.println("\nWARNING - You may be getting scanned\nAttempt #" + attempt);
- clientSocket.close();
- serverSocket.close();
- run1 = 0;
- }
- if(inp == null){
- run1 = 0;
- }}}
- System.out.println(inet.getHostName());
- String in3t = inet.getHostAddress();
- Process pro = run.exec(cmd + in3t);
- pro.waitFor();
- BufferedReader buff = new BufferedReader(new InputStreamReader(pro.getInputStream()));
- String line = "";
- lop = lop - 1;
- attempt = attempt + 1;
- while((line = buff.readLine())!= null){
- System.out.println(line);
- fout.write(line + "\n");
- }
- if(lop == 0){
- System.out.println("Socket Status: Closed");
- System.out.println("Connection limit reached.");
- clientSocket.close();
- serverSocket.close();
- }}finally{
- System.out.println("Connection attemp #" + attempt);
- }}}
- // Custom=======================================================================================================
- if (banner == 3){
- System.out.println("Fixing bugs and optimizing code, check the blog for an update - www.hakhub.blogspot.com");
- }
- //write alert to a logfile and closes the socket
- serverSocket.close();
- System.out.println("\nClosing sockets and saving " + logf + " to " + dir.getCanonicalPath());
- System.exit(1);
- fout.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement