Rabu, 04 Juli 2018

Java Code baca isi tasklist

run:
# =>
#csrss.exe                      824 Console                    1      3,428 K =>csrss.exe
#winlogon.exe                   988 Console                    1      4,088 K =>winlogon.exe
#fontdrvhost.exe                528 Console                    1      3,364 K =>fontdrvhost.exe
#dwm.exe                       1184 Console                    1     47,680 K =>dwm.exe
#nvxdsync.exe                  6912 Console                    1     10,952 K =>nvxdsync.exe
#ByteFence.exe                15160 Console                    1    153,172 K =>ByteFence.exe
#explorer.exe                 16348 Console                    1    126,088 K =>explorer.exe
#sihost.exe                    9424 Console                    1     28,016 K =>sihost.exe
#rtop_bg.exe                  20976 Console                    1     10,168 K =>rtop_bg.exe
#svchost.exe                  16436 Console                    1     21,636 K =>svchost.exe
#dllhost.exe                  16072 Console                    1     11,336 K =>dllhost.exe
#svchost.exe                  20632 Console                    1     34,052 K =>svchost.exe
#ShellExperienceHost.exe       9332 Console                    1     72,164 K =>ShellExperienceHost.exe
#RemindersServer.exe           8908 Console                    1     17,568 K =>RemindersServer.exe
#svchost.exe                  17176 Console                    1     17,096 K =>svchost.exe
#RuntimeBroker.exe            12256 Console                    1     25,676 K =>RuntimeBroker.exe
#RuntimeBroker.exe            11756 Console                    1     34,568 K =>RuntimeBroker.exe
#dllhost.exe                   1808 Console                    1     15,012 K =>dllhost.exe
#ctfmon.exe                    6928 Console                    1     15,388 K =>ctfmon.exe
#dllhost.exe                   5988 Console                    1      9,108 K =>dllhost.exe
#ApplicationFrameHost.exe     14608 Console                    1     23,028 K =>ApplicationFrameHost.exe
#xampp-control.exe            11152 Console                    1     16,828 K =>xampp-control.exe
#mysqld.exe                   11924 Console                    1      8,992 K =>mysqld.exe
#httpd.exe                     7684 Console                    1     11,788 K =>httpd.exe
#conhost.exe                   4196 Console                    1      6,300 K =>conhost.exe
#httpd.exe                    20920 Console                    1     15,088 K =>httpd.exe
#LockApp.exe                   1432 Console                    1     39,696 K =>LockApp.exe
#RuntimeBroker.exe            14904 Console                    1     29,820 K =>RuntimeBroker.exe
#SettingSyncHost.exe           9032 Console                    1      3,288 K =>SettingSyncHost.exe
#SkypeHost.exe                11904 Console                    1     11,388 K =>SkypeHost.exe
#SearchUI.exe                  3808 Console                    1     91,732 K =>SearchUI.exe
#RuntimeBroker.exe            13956 Console                    1     24,168 K =>RuntimeBroker.exe
#chrome.exe                   20948 Console                    1    179,828 K =>chrome.exe
#chrome.exe                    4260 Console                    1      7,732 K =>chrome.exe
#chrome.exe                   16736 Console                    1      8,420 K =>chrome.exe
#chrome.exe                     324 Console                    1    146,356 K =>chrome.exe
#chrome.exe                   10844 Console                    1    144,436 K =>chrome.exe
#chrome.exe                   10596 Console                    1     30,024 K =>chrome.exe
#chrome.exe                   15216 Console                    1     33,724 K =>chrome.exe
#chrome.exe                   10704 Console                    1    266,568 K =>chrome.exe
#chrome.exe                   17144 Console                    1    288,984 K =>chrome.exe
#chrome.exe                   11124 Console                    1    143,640 K =>chrome.exe
#chrome.exe                   20416 Console                    1    143,180 K =>chrome.exe
#chrome.exe                   14028 Console                    1    125,476 K =>chrome.exe
#WsftpCOMHelper.exe            8176 Console                    1     12,064 K =>WsftpCOMHelper.exe
#chrome.exe                    4648 Console                    1     87,144 K =>chrome.exe
#chrome.exe                    8096 Console                    1     23,452 K =>chrome.exe
#studio64.exe                  4080 Console                    1    289,272 K =>studio64.exe
#fsnotifier64.exe             10188 Console                    1      2,836 K =>fsnotifier64.exe
#conhost.exe                   4764 Console                    1      5,096 K =>conhost.exe
#netbeans64.exe                5400 Console                    1    537,440 K =>netbeans64.exe
#chrome.exe                    6172 Console                    1     94,432 K =>chrome.exe
#chrome.exe                    2368 Console                    1     65,776 K =>chrome.exe
#java.exe                      7064 Console                    1    106,756 K =>java.exe
#chrome.exe                   20576 Console                    1     53,508 K =>chrome.exe
#notepad++.exe                10244 Console                    1     18,272 K =>notepad++.exe
#chrome.exe                     388 Console                    1    114,788 K =>chrome.exe
#chrome.exe                   13596 Console                    1     26,772 K =>chrome.exe
#chrome.exe                   14640 Console                    1     38,508 K =>chrome.exe
#chrome.exe                   14472 Console                    1     66,508 K =>chrome.exe
#chrome.exe                     212 Console                    1    178,640 K =>chrome.exe
#chrome.exe                    6736 Console                    1     74,724 K =>chrome.exe
#chrome.exe                   12968 Console                    1     87,564 K =>chrome.exe
#chrome.exe                    6800 Console                    1     79,912 K =>chrome.exe
#chrome.exe                   16952 Console                    1     90,992 K =>chrome.exe
#chrome.exe                    9380 Console                    1     96,300 K =>chrome.exe
#chrome.exe                    9004 Console                    1     22,512 K =>chrome.exe
#backgroundTaskHost.exe        6556 Console                    1     21,656 K =>backgroundTaskHost.exe
#RuntimeBroker.exe            20584 Console                    1     33,636 K =>RuntimeBroker.exe
#RuntimeBroker.exe            19708 Console                    1      7,116 K =>RuntimeBroker.exe
#java.exe                     11632 Console                    1     18,916 K =>java.exe
#conhost.exe                   6748 Console                    1      9,836 K =>conhost.exe
#tasklist.exe                 11908 Console                    1      7,632 K =>tasklist.exe
#conhost.exe                   4400 Console                    1      9,692 K =>conhost.exe
######################
Lalu dibuat UNIQ
*
*csrss.exe
*winlogon.exe
*fontdrvhost.exe
*dwm.exe
*nvxdsync.exe
*ByteFence.exe
*explorer.exe
*sihost.exe
*rtop_bg.exe
*svchost.exe
*dllhost.exe
*ShellExperienceHost.exe
*RemindersServer.exe
*RuntimeBroker.exe
*ctfmon.exe
*ApplicationFrameHost.exe
*xampp-control.exe
*mysqld.exe
*httpd.exe
*conhost.exe
*LockApp.exe
*SettingSyncHost.exe
*SkypeHost.exe
*SearchUI.exe
*chrome.exe
*WsftpCOMHelper.exe
*studio64.exe
*fsnotifier64.exe
*netbeans64.exe
*java.exe
*notepad++.exe
*backgroundTaskHost.exe
*tasklist.exe

LALU DIRANGKUM:
isitaskList,csrss.exe,winlogon.exe,fontdrvhost.exe,dwm.exe,nvxdsync.exe,ByteFence.exe,explorer.exe,sihost.exe,rtop_bg.exe,svchost.exe,dllhost.exe,ShellExperienceHost.exe,RemindersServer.exe,RuntimeBroker.exe,ctfmon.exe,ApplicationFrameHost.exe,xampp-control.exe,mysqld.exe,httpd.exe,conhost.exe,LockApp.exe,SettingSyncHost.exe,SkypeHost.exe,SearchUI.exe,chrome.exe,WsftpCOMHelper.exe,studio64.exe,fsnotifier64.exe,netbeans64.exe,java.exe,notepad++.exe,backgroundTaskHost.exe,tasklist.exe,

BUILD SUCCESSFUL (total time: 0 seconds)



package currentos;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;

public class CurrentOS {

    public static void main(String[] args) {
        CurrentOS x=new CurrentOS();
        String isitaskList=x.baca();
        System.out.println("isitaskList"+isitaskList);
    }
   
    String baca() {
         String gab="";
        try{
        String line="";
            Process p = Runtime.getRuntime().exec("tasklist.exe /nh");
            BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
           
            List listA = new ArrayList();
            while ((line = input.readLine()) != null) {
                if(line.indexOf("Services")<0){
                    String[]ar=line.split(" ");
                    String console=ar[0];
                        //System.out.println("#"+line+" =>"+console);
                        listA.add(console);
                }
            }//while
           
        int jd=listA.size();
        //System.out.println("######################");   
        ArrayList<String> unique = removeDuplicates((ArrayList<String>) listA);
     
        for (String element : unique) {
           // System.out.println("*"+element);
            gab+=element+",";
        }
       
        }
        catch(Exception ee){}
           return gab;
    }
   
   
   
   
    static ArrayList<String> removeDuplicates(ArrayList<String> list) {
        ArrayList<String> result = new ArrayList<>();
        HashSet<String> set = new HashSet<>();
        for (String item : list) {
            if (!set.contains(item)) {
                result.add(item);
                set.add(item);
            }
        }
        return result;
    }
}



Tidak ada komentar:

Posting Komentar