You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: linux-1/linux-redteam/enumeration.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,34 @@ file $file
96
96
lsof +L1
97
97
```
98
98
99
+
### Read extended attributes of a file
100
+
101
+
```
102
+
lsattr $file
103
+
```
104
+
105
+
Normally, using this command on a directory will cause it to list the attributes of the files inside that directory. However, you can force `lsattr` to treat a directory as a file and produce file attribute information for it by using the `-d` command line option.
106
+
107
+
```
108
+
lsattr -d /home/user
109
+
```
110
+
111
+
### Change attributes of a file
112
+
113
+
```
114
+
chattr $file
115
+
```
116
+
117
+
> The format of a symbolic mode is `+-=[aAcCdDeijsStTu]`
118
+
>
119
+
> The operator `'+'` causes the selected attributes to be added to the existing attributes of the files; `'-'` causes them to be removed; and `'='` causes them to be the only attributes that the files have.
120
+
>
121
+
> The letters `'aAcCdDeijsStTu'` select the new attributes for the files: append only (a), no atime updates (A), compressed (c), no copy-on-write (C), no dump (d), synchronous directory updates (D), extent format (e), immutable (i), data journalling (j), secure deletion (s), synchronous updates (S), no tail-merging (t), top of directory hierarchy (T), and undeletable (u).
122
+
>
123
+
> The following attributes are read-only and may be listed by `lsattr` but not modified by `chattr`: compression error (E), huge file (h), indexed directory (I), inline data (N), compression raw access (X), and compressed dirty file (Z).
124
+
>
125
+
> Not all flags are supported or utilized by all filesystems; refer to filesystem-specific man pages such as btrfs, ext4, and xfs for more filesystem-specific details.
Gets display name, description, lockout status, password requirements, login name and domain, and SID.
107
93
108
94
If run on a domain connected machine dumps all accounts on the whole domain! On a non-domain joined machine lists all local users. Includes Service Accounts.  
This will recursively (`/T`) search the "C:\Program Files\\" folder, ignoring errors (`/C`).
341
-
{% endtab %}
342
-
{% endtabs %}
343
-
344
-
 More good groups to search for would be the "BUILTIN\Users" or "Domain Users" groups.
345
-
346
-
#### Using accesschk.exe (SysInternals)
347
-
348
-
You can also use `accesschk.exe` from Sysinternals to check for writeable folders and files.
349
-
350
-
```
351
-
accesschk.exe -qwsu "Everyone" *
352
-
accesschk.exe -qwsu "Authenticated Users" *
353
-
accesschk.exe -qwsu "Users" *
224
+
reg query HKLM /f password /t REG_SZ /s
225
+
reg query HKCU /f password /t REG_SZ /s
354
226
```
355
227
356
228
## OS Information
@@ -734,24 +606,6 @@ If you are having this error (for example with SSDPSRV):
734
606
>
735
607
> Note: In Windows XP SP1, the service upnphost depends on SSDPSRV to work
736
608
737
-
### Unquoted service paths
738
-
739
-
Unquoted service paths are paths to services that contain a space in them, that are not surrounded by quotes. These paths can be hijacked to run arbitrary code if the break in the path is a writeable location.
wmic service get name,displayname,pathname,startmode 2>nul |findstr /i "Auto" 2>nul |findstr /i /v "C:\Windows\\" 2>nul |findstr /i /v """
751
-
```
752
-
{% endtab %}
753
-
{% endtabs %}
754
-
755
609
### Get running processes
756
610
757
611
{% tabs %}
@@ -944,27 +798,30 @@ ForEach ($Connection in $CONNECTIONS)
944
798
945
799
[https://github.com/carlospolop/hacktricks/blob/master/windows/basic-cmd-for-pentesters.md#network](https://github.com/carlospolop/hacktricks/blob/master/windows/basic-cmd-for-pentesters.md#network) (TODO:check for more network enumeration info here)
946
800
947
-
### Startup/AutoRuns
801
+
### AutoRuns
948
802
949
-
Check which files are executed when the computer is started, or a user is logged in. 
803
+
Check which files are executed when the computer is started. Components that are executed when a user logins can be exploited to execute malicious code when the administrator logins. (cmd.exe)
950
804
951
805
{% tabs %}
952
806
{% tab title="PowerShell" %}
807
+
808
+
953
809
```powershell
954
810
Get-CimInstance Win32_StartupCommand | select Name, command, Location, User | fl
@@ -1014,24 +871,14 @@ Server Message Block is a service that enables the user to share files with othe
1014
871
*`smbver.sh $ip $port` 
1015
872
* Use Wireshark to check pcap
1016
873
1017
-
### List share drives
874
+
### Share List:
1018
875
1019
876
```bash
1020
877
smbclient --list $ip
1021
878
smbclient -L $ip
1022
879
smbmap -H $computer
1023
880
```
1024
881
1025
-
#### Find all connected drives
1026
-
1027
-
This can show all connected hard drives, not only network fileshares
1028
-
1029
-
```powershell
1030
-
Get-PSDrive | where {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"}| ft Name,Root
1031
-
```
1032
-
1033
-
Listing all PSDrives can also give you valuable information, showing how to access environment variables, certificates, registry keys, temp folders, and more.
0 commit comments