Skip to content

Commit 0666bc2

Browse files
carlospolopgitbook-bot
authored andcommitted
GitBook: [#3165] No subject
1 parent 9f30d3b commit 0666bc2

File tree

115 files changed

+1925
-1457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1925
-1457
lines changed

6881-udp-pentesting-bittorrent.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 6881/udp - Pentesting BitTorrent
1+
22

33
<details>
44

@@ -16,6 +16,9 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
1616

1717
</details>
1818

19+
20+
21+
1922
<details>
2023

2124
<summary><strong>Support HackTricks and get benefits!</strong></summary>
@@ -31,3 +34,5 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
3134
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
3235

3336
</details>
37+
38+

a.i.-exploiting/bra.i.nsmasher-presentation/README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# BRA.I.NSMASHER Presentation
1+
22

33
<details>
44

@@ -16,7 +16,8 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
1616

1717
</details>
1818

19-
## Presentation
19+
20+
# Presentation
2021

2122
**BrainSmasher** is a platform made with the purpose of aiding **pentesters, researcher, students, A.I. Cybersecurity engineers** to practice and learn all the techniques for **exploiting commercial A.I.** applications, by working on specifically crafted labs that reproduce several systems, like face recognition, speech recognition, ensemble image classification, autonomous drive, malware evasion, chatbot, data poisoning etc...
2223

@@ -36,7 +37,7 @@ _A big thanks to Hacktricks and Carlos Polop for giving us this opportunity_
3637

3738
> _Walter Miele from BrA.I.nsmasher_
3839
39-
## Registry Challenge
40+
# Registry Challenge
4041

4142
In order to register in [**BrA.I.Smasher** ](https://beta.brainsmasher.eu)you need to solve an easy challenge ([**here**](https://beta.brainsmasher.eu/registrationChallenge)).\
4243
Just think how you can confuse a neuronal network while not confusing the other one knowing that one detects better the panda while the other one is worse...
@@ -47,12 +48,13 @@ However, if at some point you **don't know how to solve** the challenge, or **ev
4748

4849
I have to tell you that there are **easier ways** to pass the challenge, but this **solution** is **awesome** as you will learn how to pass the challenge performing an **Adversarial Image performing a Fast Gradient Signed Method (FGSM) attack for images.**
4950

50-
## More Tutorials
51+
# More Tutorials
5152

5253
{% content-ref url="basic-captcha-breaker.md" %}
5354
[basic-captcha-breaker.md](basic-captcha-breaker.md)
5455
{% endcontent-ref %}
5556

57+
5658
<details>
5759

5860
<summary><strong>Support HackTricks and get benefits!</strong></summary>
@@ -68,3 +70,5 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
6870
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
6971

7072
</details>
73+
74+

a.i.-exploiting/bra.i.nsmasher-presentation/basic-bruteforcer.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Basic Bruteforcer
1+
22

33
<details>
44

@@ -16,7 +16,8 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
1616

1717
</details>
1818

19-
## BRUTEFORCER IMAGE CORRUPTION SCRIPT
19+
20+
# BRUTEFORCER IMAGE CORRUPTION SCRIPT
2021

2122
The purpose here is to introduce the user to some basic concepts about **A.I. apps exploiting**, via some easy to follow scripts, which represents the core for writing useful tools.\<br>\
2223
In this example (which can be used to solve the easy labs of BrainSmasher) by recalling also what is written in the solution for the introduction challenge, we will provide a simple yet useful way, in order to iteratively produce some corrupted images, to bruteforce the face recon easy labs (and thus also real applications that relies on the same principles)
@@ -29,6 +30,7 @@ Try it on our labs [**BrA.I.Smasher Website**](https://beta.brainsmasher.eu)
2930

3031
Enjoy and stay safe!
3132

33+
3234
<details>
3335

3436
<summary><strong>Support HackTricks and get benefits!</strong></summary>
@@ -44,3 +46,5 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
4446
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
4547

4648
</details>
49+
50+

a.i.-exploiting/bra.i.nsmasher-presentation/basic-captcha-breaker.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Basic Captcha Breaker
1+
22

33
<details>
44

@@ -16,10 +16,13 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
1616

1717
</details>
1818

19-
In this tutorial **a basic captcha is going to be broken**.\
19+
20+
In this tutorial **a basic captcha is going to be broken**.
2021
A **NN is going to be trained** using several **images** that represents **letters** and then this NN is going to be used to **automatically identify the letters inside a captcha image**.
2122

22-
Check the awesome guided tutorial provided by [**BrA.In Smasher**](https://beta.brainsmasher.eu) in this [**google collab page**](https://colab.research.google.com/drive/1uiQJpqEj5V2\_ijoumSd2noaDJuniTlKq?usp=sharing).
23+
Check the awesome guided tutorial provided by [**BrA.In Smasher**](https://beta.brainsmasher.eu/) in this [**google collab page**](https://colab.research.google.com/drive/1uiQJpqEj5V2_ijoumSd2noaDJuniTlKq?usp=sharing).
24+
25+
2326

2427
<details>
2528

@@ -36,3 +39,5 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
3639
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
3740

3841
</details>
42+
43+

a.i.-exploiting/bra.i.nsmasher-presentation/bim-bruteforcer.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# BIM Bruteforcer
1+
22

33
<details>
44

@@ -16,9 +16,10 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
1616

1717
</details>
1818

19-
## BRUTEFORCER CORE SCRIPT WITH BIM ATTACK
2019

21-
This time we introduce a new type of gradient based attack, in order to brute force an image classification app (can be shaped and used for any input of course), the BIM, or Basic Iteration Method.
20+
# BRUTEFORCER CORE SCRIPT WITH BIM ATTACK
21+
22+
This time we introduce a new type of gradient based attack, in order to brute force an image classification app \(can be shaped and used for any input of course\), the BIM, or Basic Iteration Method.
2223

2324
It’s recommended to see at least the explanation in the [**introduction challenge colab Notebook**](https://colab.research.google.com/drive/1lDh0oZ3TR-z87WjogdegZCdtsUuDADcR)
2425

@@ -30,6 +31,8 @@ As usual we will provide only the A.I. attack core part, it’s up to you to com
3031
Remember, in those kind of scenarios, in order to mime real-based attack applications, we don’t have the exact model to fool or the image target in which we would like to transform our image. That’s why, in order to overcome this issue, we must blend our core script, with a bruteforcer logic, accordingly to the application responses we want to fool.
3132
{% endhint %}
3233

34+
35+
3336
<details>
3437

3538
<summary><strong>Support HackTricks and get benefits!</strong></summary>
@@ -45,3 +48,5 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
4548
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
4649

4750
</details>
51+
52+

a.i.-exploiting/bra.i.nsmasher-presentation/hybrid-malware-classifier-part-1.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Hybrid Malware Classifier Part 1
1+
22

33
<details>
44

@@ -16,9 +16,10 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
1616

1717
</details>
1818

19-
## A.I. HYBRID MALWARE CLASSIFIER
2019

21-
### INTERMEDIATE PYTHON SKILL, INTERMEDIATE MACHINE LEARNING SKILLS (Part 1)
20+
# A.I. HYBRID MALWARE CLASSIFIER
21+
22+
## INTERMEDIATE PYTHON SKILL, INTERMEDIATE MACHINE LEARNING SKILLS \(Part 1\)
2223

2324
In this series of notebook we are going to build an **hybrid malware classifier.**
2425

@@ -34,7 +35,9 @@ For the **Fourth Part** For the Fourth Part we will add some tactics to add robu
3435

3536
There are also many available datasets for Static and/ or Dynamic Malware analysis on several sites for this type of classification, like Ember, VirusShare, Sorel-20M, but i strongly encourage that you build one or your own.
3637

37-
Here’s the link to our [**colab notebook**](https://colab.research.google.com/drive/1nNZLMogXF-iq-\_78IvGTd-c89\_C82AB8#scrollTo=lUHLMl8Pusrn) enjoy and stay safe :)
38+
Here’s the link to our [**colab notebook**](https://colab.research.google.com/drive/1nNZLMogXF-iq-_78IvGTd-c89_C82AB8#scrollTo=lUHLMl8Pusrn) enjoy and stay safe :\)
39+
40+
3841

3942
<details>
4043

@@ -51,3 +54,5 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
5154
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
5255

5356
</details>
57+
58+

a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ML Basics
1+
22

33
<details>
44

@@ -16,6 +16,9 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
1616

1717
</details>
1818

19+
20+
21+
1922
<details>
2023

2124
<summary><strong>Support HackTricks and get benefits!</strong></summary>
@@ -31,3 +34,5 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
3134
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
3235

3336
</details>
37+
38+

a.i.-exploiting/bra.i.nsmasher-presentation/ml-basics/feature-engineering.md

+21-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Feature Engineering
1+
22

33
<details>
44

@@ -16,21 +16,22 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
1616

1717
</details>
1818

19-
## Basic types of possible data
19+
20+
# Basic types of possible data
2021

2122
Data can be **continuous** (**infinity** values) or **categorical** (nominal) where the amount of possible values are **limited**.
2223

23-
### Categorical types
24+
## Categorical types
2425

25-
#### Binary
26+
### Binary
2627

2728
Just **2 possible values**: 1 or 0. In case in a dataset the values are in string format (e.g. "True" and "False") you assign numbers to those values with:
2829

2930
```python
3031
dataset["column2"] = dataset.column2.map({"T": 1, "F": 0})
3132
```
3233

33-
#### **Ordinal**
34+
### **Ordinal**
3435

3536
The **values follows an order**, like in: 1st place, 2nd place... If the categories are strings (like: "starter", "amateur", "professional", "expert") you can map them to numbers as we saw in the binary case.
3637

@@ -49,7 +50,7 @@ possible_values_mapping = {value:idx for idx,value in enumerate(possible_values_
4950
dataset['column2'] = dataset.column2.map(possible_values_mapping)
5051
```
5152

52-
#### **Cyclical**
53+
### **Cyclical**
5354

5455
Looks **like ordinal value** because there is an order, but it doesn't mean one is bigger than the other. Also the **distance between them depends on the direction** you are counting. Example: The days of the week, Sunday isn't "bigger" than Monday.
5556

@@ -60,7 +61,7 @@ column2_dummies = pd.get_dummies(dataset.column2, drop_first=True)
6061
dataset_joined = pd.concat([dataset[['column2']], column2_dummies], axis=1)
6162
```
6263

63-
#### **Dates**
64+
### **Dates**
6465

6566
Date are **continuous** **variables**. Can be seen as **cyclical** (because they repeat) **or** as **ordinal** variables (because a time is bigger than a previous one).
6667

@@ -94,7 +95,7 @@ dataset['weekday'] = dataset.transaction_date.dt.weekday
9495
dataset['day_name'] = dataset.transaction_date.apply(lambda x: x.day_name())
9596
```
9697

97-
#### Multi-category/nominal
98+
### Multi-category/nominal
9899

99100
**More than 2 categories** with no related order. Use `dataset.describe(include='all')` to get information about the categories of each feature.
100101

@@ -107,7 +108,7 @@ You can get a **multi-category column one-hot encoded** with `pd.get_dummies(dat
107108

108109
You can get a **multi-category column dummie encoded** with `pd.get_dummies(dataset.column1, drop_first=True)`. This will transform all the classes in binary features, so this will create **one new column per possible class minus one** as the **last 2 columns will be reflect as "1" or "0" in the last binary column created**. This will avoid perfect multicollinearity, reducing the relations between columns.
109110

110-
## Collinear/Multicollinearity
111+
# Collinear/Multicollinearity
111112

112113
Collinear appears when **2 features are related to each other**. Multicollineratity appears when those are more than 2.
113114

@@ -125,7 +126,7 @@ X = add_constant(onehot_encoded) # Add previously one-hot encoded data
125126
print(pd.Series([variance_inflation_factor(X.values,i) for i in range(X.shape[1])], index=X.columns))
126127
```
127128

128-
## Categorical Imbalance
129+
# Categorical Imbalance
129130

130131
This occurs when there is **not the same amount of each category** in the training data.
131132

@@ -174,7 +175,7 @@ You can use the argument **`sampling_strategy`** to indicate the **percentage**
174175
Undersamplig or Oversampling aren't perfect if you get statistics (with `.describe()`) of the over/under-sampled data and compare them to the original you will see **that they changed.** Therefore oversampling and undersampling are modifying the training data.
175176
{% endhint %}
176177

177-
### SMOTE oversampling
178+
## SMOTE oversampling
178179

179180
**SMOTE** is usually a **more trustable way to oversample the data**.
180181

@@ -189,13 +190,13 @@ dataset['target_column'] = y_smote
189190
print(y_smote.value_counts()) #Confirm data isn't imbalanced anymore
190191
```
191192

192-
## Rarely Occurring Categories
193+
# Rarely Occurring Categories
193194

194195
Imagine a dataset where one of the target classes **occur very little times**.
195196

196197
This is like the category imbalance from the previous section, but the rarely occurring category is occurring even less than "minority class" in that case. The **raw** **oversampling** and **undersampling** methods could be also used here, but generally those techniques **won't give really good results**.
197198

198-
### Weights
199+
## Weights
199200

200201
In some algorithms it's possible to **modify the weights of the targeted data** so some of them get by default more importance when generating the model.
201202

@@ -206,13 +207,13 @@ model = LogisticRegression(class_weight=weights)
206207

207208
You can **mix the weights with over/under-sampling techniques** to try to improve the results.
208209

209-
### PCA - Principal Component Analysis
210+
## PCA - Principal Component Analysis
210211

211212
Is a method that helps to reduce the dimensionality of the data. It's going to **combine different features** to **reduce the amount** of them generating **more useful features** (_less computation is needed_).
212213

213214
The resulting features aren't understandable by humans, so it also **anonymize the data**.
214215

215-
## Incongruent Label Categories
216+
# Incongruent Label Categories
216217

217218
Data might have mistakes for unsuccessful transformations or just because human error when writing the data.
218219

@@ -222,7 +223,7 @@ You can clean this issues by lowercasing everything and mapping misspelled label
222223

223224
It's very important to check that **all the data that you have contains is correctly labeled**, because for example, one misspelling error in the data, when dummie encoding the classes, will generate a new column in the final features with **bad consequences for the final model**. This example can be detected very easily by one-hot encoding a column and checking the names of the columns created.
224225

225-
## Missing Data
226+
# Missing Data
226227

227228
Some data of the study may be missing.
228229

@@ -290,7 +291,7 @@ dataset.iloc[10:20] # Get some indexes that contained empty data before
290291

291292
To fill categorical data first of all you need to think if there is any reason why the values are missing. If it's by **choice of the users** (they didn't want to give the data) maybe yo can **create a new category** indicating that. If it's because of human error you can **remove the rows** or the **feature** (check the steps mentioned before) or **fill it with the mode, the most used category** (not recommended).
292293

293-
## Combining Features
294+
# Combining Features
294295

295296
If you find **two features** that are **correlated** between them, usually you should **drop** one of them (the one that is less correlated with the target), but you could also try to **combine them and create a new feature**.
296297

@@ -307,6 +308,7 @@ X = add_constant(dataset[['column1', 'column2', 'target']])
307308
pd.Series([variance_inflation_factor(X.values, i) for i in range(X.shape[1])], index=X.columns)
308309
```
309310

311+
310312
<details>
311313

312314
<summary><strong>Support HackTricks and get benefits!</strong></summary>
@@ -322,3 +324,5 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
322324
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
323325

324326
</details>
327+
328+

backdoors/empire.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Empire
1+
22

33
<details>
44

@@ -16,6 +16,9 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
1616

1717
</details>
1818

19+
20+
21+
1922
<details>
2023

2124
<summary><strong>Support HackTricks and get benefits!</strong></summary>
@@ -31,3 +34,5 @@ Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
3134
**Share your hacking tricks submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
3235

3336
</details>
37+
38+

0 commit comments

Comments
 (0)