Advertisement
Guest User

Frag 1.1 Anti-Cheat part 6 GUI+ blocking steam id changer

a guest
Mar 29th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 10.38 KB | None | 0 0
  1. package dbclient;
  2.  
  3. import java.awt.EventQueue;
  4.  
  5. import javax.swing.JFrame;
  6. import javax.swing.JLabel;
  7. import javax.swing.ImageIcon;
  8. import java.awt.Color;
  9. import java.awt.Font;
  10. import java.awt.Toolkit;
  11. import java.io.BufferedReader;
  12. import java.io.File;
  13. import java.io.InputStreamReader;
  14. import java.nio.file.Files;
  15. import java.nio.file.Path;
  16. import java.nio.file.attribute.BasicFileAttributeView;
  17. import java.nio.file.attribute.BasicFileAttributes;
  18. import java.util.Objects;
  19. import java.util.Timer;
  20. import java.util.TimerTask;
  21.  
  22. import javax.swing.JTextArea;
  23. import javax.swing.event.ChangeListener;
  24. import javax.swing.event.DocumentListener;
  25. import javax.swing.JButton;
  26. import javax.swing.JTextField;
  27.  
  28. public class Gui {
  29.    
  30.     private static String currentsteamId = null, realSteamId = null;
  31.     private static long temp = 0;
  32.     public static int activeUserDec = 0;
  33.     private JFrame frame;
  34.     private JTextField textField;
  35.  
  36.     /**
  37.      * Launch the application.
  38.      */
  39.     public static void main(String[] args) throws Exception {
  40.        
  41.         System.out.println("the steam needed to be close and after open the cs1.6 original(steam)");
  42.         //
  43.         if(!findRegQuery(2, 26, "reg query "  + "HKCU\\Software\\Valve\\Steam\\ActiveProcess").equals("0")) System.exit(1);
  44.         while(findRegQuery(2, 26, "reg query "  + "HKCU\\Software\\Valve\\Steam\\ActiveProcess").equals("0"));
  45.        
  46.         long time = System.currentTimeMillis();
  47.         temp = time;
  48.         while(time < temp + 20 * 1000) time += (System.currentTimeMillis() - time);
  49.         realSteamId = extricateSteamId();
  50.         System.out.println(realSteamId);
  51.         //when steam opened
  52.  
  53.         Thread csRunning = new Thread(new Runnable() {
  54.            
  55.             @Override
  56.             public void run() {
  57.                
  58.                 try {
  59.                    
  60.                     int c = 0;
  61.                     S1Task task1 = null;
  62.                    
  63.                     //if cs 1.6 original on
  64.                     while(findRegQuery(5, 30, "reg query "  + "HKCU\\Software\\Valve\\Steam\\Apps\\10").equals("1")) {
  65.                        
  66.                         if(c == 0) {
  67.                            
  68.                             currentsteamId = extricateSteamId();
  69.                             if(!realSteamId.equals(currentsteamId)) break;
  70.                            
  71.                             String steamPath = findRegQuery(9, 27, "reg query "  + "HKCU\\Software\\Valve\\Steam\\ActiveProcess");
  72.                             String ssPath = (steamPath + "\\userdata" + "\\" + activeUserDec + "\\760\\remote\\10\\screenshots").replaceAll("\\\\", "/");
  73.                             //finally get access to screenshot folder
  74.                             File ssFolder = new File(ssPath);
  75.                             //first length when the program start
  76.                             long filesSz = doEachFile(ssFolder, "length");
  77.                             Timer timer1 = new Timer();
  78.                             //send the screenshot folder and first length when the program start
  79.                             task1 = new S1Task(ssFolder, filesSz);
  80.                             timer1.schedule(task1, 1000, 10*1000);
  81.                            
  82.                         }
  83.                        
  84.                         else if(c == 1) {
  85.                             System.out.println("IN WHILE ID");
  86.                             currentsteamId = extricateSteamId();
  87.                             if(!realSteamId.equals(currentsteamId)) break;
  88.                             continue;
  89.                         }
  90.                        
  91.                         c++;
  92.                        
  93.                     }
  94.                    
  95.                     System.exit(1);
  96.                    
  97.                 } catch (Exception x1) {
  98.                     x1.printStackTrace();
  99.                 }
  100.                
  101.             }
  102.            
  103.         });
  104.         csRunning.start();
  105.        
  106.         EventQueue.invokeLater(new Runnable() {
  107.             public void run() {
  108.                 try {
  109.                    
  110.                     Gui window = new Gui();
  111.                     window.frame.setVisible(true);
  112.                 } catch (Exception e) {
  113.                     e.printStackTrace();
  114.                 }
  115.             }
  116.         });
  117.     }
  118.        
  119.     //find some String from registry by using: c = line num, s = where to start the sub String, regQuery = command reg query to cmd
  120.         public static String findRegQuery(int c, int s, String regQuery) throws Exception {
  121.            
  122.             String line = null;
  123.             int i = 0;
  124.             Runtime runtime = Runtime.getRuntime();
  125.             Process cmd = runtime.exec(regQuery);
  126.             BufferedReader in = new BufferedReader(new InputStreamReader(cmd.getInputStream()));
  127.            
  128.             while ((line = in.readLine()) != null) {
  129.                
  130.                 if(i == c) break;
  131.                 i++;
  132.                
  133.             }
  134.            
  135.             in.close();
  136.             return line.substring(s);
  137.  
  138.         }
  139.        
  140.         public static String extricateSteamId() throws Exception {
  141.            
  142.             String steamId = null;
  143.             //find active user in hexadecimal
  144.             String activeUserHex = findRegQuery(6, 33, "reg query "  + "HKCU\\Software\\Valve\\Steam\\ActiveProcess");
  145.             //convert hexadecimal to decimal
  146.             activeUserDec = Integer.parseInt(activeUserHex, 16);
  147.             //convert int to String
  148.             String activeUserString = String.valueOf(activeUserDec);
  149.             int lActiveUser = activeUserString.length();
  150.             //the last digit (String)
  151.             String lastDigitS = activeUserString.substring(lActiveUser - 1 , lActiveUser);
  152.             //convert the last digit to int
  153.             int lastDigit = Integer.parseInt(lastDigitS);  
  154.             int tempActiveUserDec = activeUserDec;
  155.             //if the last digit is: even-num OR odd-num
  156.             if(lastDigit % 2 == 0) {
  157.                 tempActiveUserDec /= 2;
  158.                 return steamId = "STEAM_0:0:" + tempActiveUserDec;
  159.             } else {
  160.                 tempActiveUserDec = (activeUserDec -= 1) / 2;
  161.                 return steamId = "STEAM_0:1:" + tempActiveUserDec;
  162.             }
  163.            
  164.         }
  165.        
  166.         //do the command on the folder files
  167.         public static long doEachFile(File folder, String command) {
  168.            
  169.             long returnValue = 0;
  170.             if(command.equals("length")) for(File file : folder.listFiles()) if(file.isFile()) returnValue += file.length();
  171.             if(command.equals("count")) for(File file : folder.listFiles()) if(file.isFile()) returnValue += 1;
  172.             return returnValue;
  173.            
  174.         }
  175.        
  176.         //return creation time of file
  177.         public static long fileCreationDate(File file) throws Exception {
  178.            
  179.             Path p = file.toPath();
  180.             BasicFileAttributes view = Files.getFileAttributeView(p, BasicFileAttributeView.class).readAttributes();
  181.             String tempCd = view.creationTime().toString().replaceAll("-", "0").replaceAll(":", "0").replaceAll("T", "0");
  182.             tempCd = tempCd.substring(0, 19);
  183.             long creationDate = Long.parseLong(tempCd);
  184.             return creationDate;
  185.            
  186.         }
  187.        
  188.         //compare files creation and sorting by date
  189.         public static File sortFolder(File folder) throws Exception {
  190.            
  191.             File[] listFiles = folder.listFiles();
  192.             File filex = null;
  193.             long created = 0;
  194.             int result = 0;
  195.             int index = 0;
  196.            
  197.             if(doEachFile(folder, "count") == 0) return filex;
  198.            
  199.             else {
  200.                
  201.                 //find the first file
  202.                 for(int i = 0; i < listFiles.length - 1; i++) {
  203.                     if(listFiles[i].isFile()) {
  204.                         created = fileCreationDate(listFiles[i]);
  205.                         filex = listFiles[i];
  206.                         index = i;
  207.                         break;
  208.                     }
  209.                 }
  210.                 if(doEachFile(folder, "count") == 1) return filex;
  211.                
  212.                 else {
  213.                    
  214.                     //compare and find the last file that was created
  215.                     for(int i = (index + 1); i < listFiles.length - 1; i++) {
  216.                        
  217.                         if(listFiles[i].isFile()) {
  218.                             result = Long.compare(fileCreationDate(listFiles[i]), created);
  219.                             if(result > 0) {
  220.                                 created = fileCreationDate(listFiles[i]);
  221.                                 filex = listFiles[i];
  222.                             }
  223.                         }
  224.                        
  225.                     }
  226.                    
  227.                     return filex;
  228.                 }
  229.             }
  230.            
  231.         }
  232.  
  233.     /**
  234.      * Create the application.
  235.      */
  236.     public Gui() {
  237.         initialize();
  238.     }
  239.  
  240.     /**
  241.      * Initialize the contents of the frame.
  242.      */
  243.     private void initialize() {
  244.         frame = new JFrame();
  245.         frame.setBounds(100, 100, 564, 337);
  246.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  247.         frame.getContentPane().setLayout(null);
  248.         frame.setTitle("Frag Anti-Cheat: Corona Version");
  249.         ImageIcon imgicon = new ImageIcon("C:\\Users\\doron\\eclipse-workspace\\dbclient\\img\\4.jpg");
  250.         frame.setIconImage(imgicon.getImage());
  251.         frame.setResizable(false);
  252.        
  253.         JLabel l1 = new JLabel("");
  254.         l1.setIcon(new ImageIcon("C:\\Users\\doron\\eclipse-workspace\\dbclient\\img\\5.png"));
  255.         l1.setBounds(1, 196, 200, 120);
  256.         frame.getContentPane().add(l1);
  257.        
  258.         JTextArea t1 = new JTextArea();
  259.         t1 .setFont(new Font("Monospaced", Font.BOLD, 12));
  260.         t1 .setBounds(408, 93, 138, 20);
  261.         t1.setText(currentsteamId );
  262.         t1.setEditable(false);
  263.         frame.getContentPane().add(t1 );
  264.        
  265.         JLabel l2 = new JLabel("סטיים איידי");
  266.         l2.setFont(new Font("Tahoma", Font.BOLD, 16));
  267.         l2.setForeground(Color.WHITE);
  268.         l2.setBounds(459, 75, 87, 17);
  269.         frame.getContentPane().add(l2);
  270.        
  271.         JLabel l3 = new JLabel("Anti-Cheat");
  272.         l3.setFont(new Font("Source Sans Pro Black", Font.BOLD | Font.ITALIC, 14));
  273.         l3.setForeground(Color.WHITE);
  274.         l3.setBounds(450, 36, 73, 14);
  275.         frame.getContentPane().add(l3);
  276.        
  277.         JLabel l4 = new JLabel("created by doron bachar");
  278.         l4.setFont(new Font("Tahoma", Font.BOLD, 14));
  279.         l4.setForeground(Color.WHITE);
  280.         l4.setBounds(360, 287, 175, 17);
  281.         frame.getContentPane().add(l4);
  282.        
  283.         JLabel l5 = new JLabel("");
  284.         l5.setIcon(new ImageIcon("C:\\Users\\doron\\eclipse-workspace\\dbclient\\img\\4.jpg"));
  285.         l5.setBounds(429, 0, 131, 65);
  286.         frame.getContentPane().add(l5);
  287.        
  288.         JLabel l6 = new JLabel("");
  289.         l6.setFont(new Font("Tahoma", Font.BOLD, 14));
  290.         l6.setIcon(new ImageIcon("C:\\Users\\doron\\eclipse-workspace\\dbclient\\img\\3.png"));
  291.         l6.setBounds(0, 0, 560, 315);
  292.         frame.getContentPane().add(l6);
  293.        
  294.     }
  295. }
  296.  
  297. //task check if there length change in screenshot folder
  298. class S1Task extends TimerTask {
  299.    
  300.     private File ssFolder;
  301.     private static long filesSz;
  302.    
  303.     //get the screenshot folder and first length when the program start
  304.     public S1Task(File ssFolder, long filesSz) {
  305.        
  306.         this.ssFolder = ssFolder;
  307.         this.filesSz = filesSz;
  308.        
  309.     }
  310.    
  311.     //instance DBClient for using his static functions
  312.     Gui test = new Gui();
  313.  
  314.   @Override
  315.   public void run() {
  316.        
  317.         try {
  318.            
  319.             //if its the first time in run func filesSz = first length when the program start
  320.             //in other times filesSz = the last length that changed (because its static var) *if the length not changed, filesSz also not
  321.             long tempChanged = test.doEachFile(ssFolder, "length");
  322.             int result = Long.compare(filesSz, tempChanged);
  323.            
  324.             //if file added
  325.             if(0 > result) {
  326.                
  327.                filesSz = tempChanged;
  328.                File recentlyCreatedFile = test.sortFolder(ssFolder);
  329.                System.out.println("screenshot added");
  330.                
  331.             //if file deleted
  332.             } else if(0 < result) {
  333.        
  334.                filesSz = tempChanged;
  335.                System.out.println("creenshot deleted");
  336.                
  337.             }
  338.                
  339.         } catch(Exception e) {
  340.             e.printStackTrace();
  341.         }
  342.        
  343.   }
  344.  
  345. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement