Skip to content

Commit b73a367

Browse files
committed
Update README.md, Docs, and added function tests for proxy detection, collection path resolution, and proxy verification with requests.
1 parent 5e93d75 commit b73a367

31 files changed

+4226
-197
lines changed

README.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,14 @@ Postman2Burp bridges the gap between API development and security testing by aut
1616

1717
## 📋 Table of Contents
1818

19-
- [Postman2Burp](#postman2burp)
20-
- [📋 Table of Contents](#-table-of-contents)
21-
- [🎯 Purpose](#-purpose)
22-
- [🔮 Assumptions](#-assumptions)
23-
- [📦 Requirements](#-requirements)
24-
- [🚀 Quick Start](#-quick-start)
25-
- [✨ Features](#-features)
26-
- [🎯 Use Cases](#-use-cases)
27-
- [⚠️ Limitations](#️-limitations)
28-
- [📚 Documentation](#-documentation)
29-
- [📜 License](#-license)
30-
- [👥 Contributing](#-contributing)
19+
<div align="center">
20+
21+
| [🎯 Purpose](#-purpose) | [🔮 Assumptions](#-assumptions) | [📦 Requirements](#-requirements) | [🚀 Quick Start](#-quick-start) |
22+
|:----------------------:|:------------------------------:|:--------------------------------:|:-------------------------------:|
23+
| [✨ Features](#-features) | [🎯 Use Cases](#-use-cases) | [⚠️ Limitations](#️-limitations) | [📚 Documentation](#-documentation) |
24+
| [🏆 Credits](#-credits) | [📜 License](#-license) | [👥 Contributing](#-contributing) | |
25+
26+
</div>
3127

3228
## 🎯 Purpose
3329

@@ -104,7 +100,7 @@ For complete examples with code samples and technical details, see our [Use Case
104100

105101
## 📚 Documentation
106102

107-
Comprehensive documentation is available in the [Wiki](https://github.com/darmado/postman2burp/wiki):
103+
Documentation is available in the [Wiki](https://github.com/darmado/postman2burp/wiki):
108104

109105
| Documentation | Description |
110106
|---------------|-------------|
@@ -115,6 +111,8 @@ Comprehensive documentation is available in the [Wiki](https://github.com/darmad
115111
| [Additional Features](https://github.com/darmado/postman2burp/wiki/Features) | Extended features and techniques |
116112
| [Configuration](https://github.com/darmado/postman2burp/wiki/Configuration) | Configuration options and settings |
117113
| [Troubleshooting](https://github.com/darmado/postman2burp/wiki/Troubleshooting) | Solutions for common issues |
114+
| [Function Map](https://github.com/darmado/postman2burp/wiki/Function-Map) | Overview of all functions and their roles |
115+
118116

119117
## 📜 License
120118

Wiki/Configuration/README.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
This guide explains how to configure Postman2Burp using configuration files and command-line options.
44

5-
## Configuration File
5+
##
6+
7+
### Configuration File
68

79
Postman2Burp supports configuration via a `config.json` file, making it easier to maintain consistent settings across multiple runs.
810

9-
### Location
11+
***Location***
1012

1113
The tool looks for a `config.json` file in the `config` directory. If found, it loads settings from this file.
1214

13-
### Sample Configuration File
15+
***Sample Configuration File***
1416

1517
```json
1618
{
@@ -21,7 +23,7 @@ The tool looks for a `config.json` file in the `config` directory. If found, it
2123
}
2224
```
2325

24-
### Available Configuration Options
26+
***Available Configuration Options***
2527

2628
| Option | Type | Description |
2729
|--------|------|-------------|
@@ -30,39 +32,45 @@ The tool looks for a `config.json` file in the `config` directory. If found, it
3032
| `verify_ssl` | Boolean | Whether to verify SSL certificates |
3133
| `skip_proxy_check` | Boolean | Whether to skip the proxy connection check |
3234

33-
## Creating a Configuration File
35+
##
36+
37+
### Creating a Configuration File
3438

3539
You can create a configuration file in two ways:
3640

37-
### 1. Manually
41+
***1. Manually***
3842

3943
Create a `config.json` file in the `config` directory using the sample above.
4044

41-
### 2. Automatically
45+
***2. Automatically***
4246

4347
Run the script with your desired settings and add the `--save-config` flag:
4448

4549
```bash
4650
python postman2burp.py --collection your_collection.json --proxy-host your-proxy-host --proxy-port 9090 --save-config
4751
```
4852

49-
## Command-Line Priority
53+
##
54+
55+
### Command-Line Priority
5056

5157
Command-line arguments always take precedence over configuration file settings. This allows you to:
5258

5359
1. Maintain default settings in the configuration file
5460
2. Override specific settings as needed for individual runs
5561

56-
## Usage Examples
62+
##
5763

58-
### Using Configuration File Only
64+
### Usage Examples
65+
66+
***Using Configuration File Only***
5967

6068
```bash
6169
# Assuming config.json exists with your settings
6270
python postman2burp.py --collection your_collection.json
6371
```
6472

65-
### Overriding Configuration File
73+
***Overriding Configuration File***
6674

6775
```bash
6876
# Override proxy host from config file
@@ -72,18 +80,20 @@ python postman2burp.py --collection your_collection.json --proxy-host different-
7280
python postman2burp.py --collection your_collection.json --proxy-port 9090
7381
```
7482

75-
### Saving New Configuration
83+
***Saving New Configuration***
7684

7785
```bash
7886
# Save current settings to config.json
7987
python postman2burp.py --collection your_collection.json --proxy-host your-proxy --proxy-port 9090 --save-config
8088
```
8189

82-
## Environment Variables
90+
##
91+
92+
### Environment Variables
8393

8494
Postman2Burp also supports environment variables for configuration. These take precedence over the configuration file but are overridden by command-line arguments.
8595

86-
### Supported Environment Variables
96+
***Supported Environment Variables***
8797

8898
| Environment Variable | Description |
8999
|----------------------|-------------|
@@ -92,7 +102,7 @@ Postman2Burp also supports environment variables for configuration. These take p
92102
| `POSTMAN2BURP_VERIFY_SSL` | Set to "true" to verify SSL certificates |
93103
| `POSTMAN2BURP_SKIP_PROXY_CHECK` | Set to "true" to skip proxy check |
94104

95-
### Example Usage
105+
***Example Usage***
96106

97107
```bash
98108
# Set environment variables
@@ -103,6 +113,8 @@ export POSTMAN2BURP_PROXY_PORT=8080
103113
python postman2burp.py --collection your_collection.json
104114
```
105115

106-
## Next Steps
116+
##
117+
118+
### Next Steps
107119

108120
- [[Troubleshooting]]

Wiki/Features/README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Additional Features
21

3-
This guide covers additional features and techniques for getting the most out of Postman2Burp.
2+
##
43

5-
## Batch Processing
4+
### Batch Processing
65

76
Process multiple collections at once using shell scripting:
87

@@ -11,30 +10,31 @@ for collection in ./collections/*.json; do
1110
python postman2burp.py --collection "$collection" --target-profile "your_profile.json"
1211
done
1312
```
13+
##
1414

15-
## Custom Proxy Configuration
15+
### Custom Proxy Configuration
1616

17-
### Combined Host:Port Format
17+
**Combined Host:Port Format**
1818

1919
```bash
2020
python postman2burp.py --collection "your_collection.json" --proxy 127.0.0.1:8888
2121
```
2222

23-
### Separate Host and Port
23+
**Separate Host and Port**
2424

2525
```bash
2626
python postman2burp.py --collection "your_collection.json" --proxy-host 127.0.0.1 --proxy-port 8888
2727
```
2828

29-
## SSL Verification
29+
**SSL Verification**
3030

3131
Enable SSL certificate verification (disabled by default):
3232

3333
```bash
3434
python postman2burp.py --collection "your_collection.json" --verify-ssl
3535
```
3636

37-
## Output Saving
37+
**Saving requests to a log file**
3838

3939
Save request and response details to a JSON file for later analysis:
4040

@@ -51,17 +51,19 @@ The output file contains an array of request/response pairs with details like:
5151
- Response body
5252
- Timing information
5353

54-
## Configuration Management
54+
##
5555

56-
### Saving Configuration
56+
### Configuration Management
57+
58+
**Saving Configuration**
5759

5860
Save your current settings to the config file for future use:
5961

6062
```bash
6163
python postman2burp.py --collection "your_collection.json" --proxy localhost:8080 --save-config
6264
```
6365

64-
### Loading Configuration
66+
**Loading Configuration**
6567

6668
The tool automatically loads settings from `config.json` if it exists. You can override specific settings with command-line arguments:
6769

@@ -70,9 +72,11 @@ The tool automatically loads settings from `config.json` if it exists. You can o
7072
python postman2burp.py --collection "different_collection.json"
7173
```
7274

73-
## CI/CD Integration
75+
##
76+
77+
### CI/CD Integration
7478

75-
### Jenkins Pipeline Example
79+
**Jenkins Pipeline Example**
7680

7781
```groovy
7882
pipeline {
@@ -105,8 +109,9 @@ pipeline {
105109
}
106110
}
107111
```
112+
##
108113

109-
## Environment Variables
114+
### Environment Variables
110115

111116
Use environment variables in your profile file:
112117

@@ -129,7 +134,7 @@ export PASSWORD="your-password"
129134
python postman2burp.py --collection "your_collection.json" --target-profile "your_profile.json"
130135
```
131136

132-
## Handling Large Collections
137+
**Handling Large Collections**
133138

134139
For large collections, you can:
135140

Wiki/Function Map/README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Function Map
2+
3+
This page provides a comprehensive overview of all functions in the Postman2Burp tool, organized by category. This map helps developers understand the codebase structure and the role of each function.
4+
5+
## Core Functions
6+
7+
| Function | Description | Return Type |
8+
|----------|-------------|-------------|
9+
| `validate_json_file(file_path)` | Validates if a file contains valid JSON and returns the parsed content | `Tuple[bool, Optional[Dict]]` |
10+
| `load_config()` | Loads configuration from the config file | `Dict` |
11+
| `save_config(config)` | Saves configuration to the config file | `bool` |
12+
| `resolve_collection_path(collection_path)` | Resolves the full path to a collection file | `str` |
13+
14+
## Proxy Management
15+
16+
| Function | Description | Return Type |
17+
|----------|-------------|-------------|
18+
| `check_proxy_connection(host, port)` | Checks if a proxy is running at the specified host and port using socket connection | `bool` |
19+
| `detect_running_proxy()` | Auto-detects running proxy by checking common proxy configurations | `Tuple[Optional[str], Optional[int]]` |
20+
| `verify_proxy_with_request(host, port)` | Verifies proxy by making a test HTTP request through it | `bool` |
21+
22+
## Variable Management
23+
24+
| Function | Description | Return Type |
25+
|----------|-------------|-------------|
26+
| `extract_variables_from_text(text)` | Extracts variables ({{variable}}) from text | `Set[str]` |
27+
| `extract_variables_from_collection(collection_path)` | Extracts all variables from a Postman collection | `Tuple[Set[str], Optional[str]]` |
28+
| `generate_variables_template(collection_path, output_path)` | Generates a template file with all variables from a collection | `None` |
29+
30+
## PostmanToBurp Class Methods
31+
32+
| Method | Description | Return Type |
33+
|--------|-------------|-------------|
34+
| `__init__(collection_path, ...)` | Initializes the PostmanToBurp object with configuration | `None` |
35+
| `load_collection()` | Loads and validates the Postman collection | `bool` |
36+
| `load_profile()` | Loads and validates the profile with variables | `bool` |
37+
| `replace_variables(text)` | Replaces variables in text with values from the profile | `str` |
38+
| `extract_requests_from_item(item, folder_name)` | Extracts requests from a collection item | `List[Dict]` |
39+
| `extract_all_requests(collection)` | Extracts all requests from the collection | `List[Dict]` |
40+
| `prepare_request(request_data)` | Prepares a request for sending (replaces variables, etc.) | `Dict` |
41+
| `send_request(prepared_request)` | Sends a request through the proxy | `Dict` |
42+
| `process_collection()` | Processes the entire collection | `None` |
43+
| `run()` | Runs the entire process and returns results | `Dict` |
44+
| `check_proxy()` | Checks if the proxy is running | `bool` |
45+
| `save_results()` | Saves results to the output file | `None` |
46+
47+
## Helper Functions
48+
49+
| Function | Description | Return Type |
50+
|----------|-------------|-------------|
51+
| `process_url(url)` | Processes URL to extract variables (internal) | `Set[str]` |
52+
| `process_body(body)` | Processes request body to extract variables (internal) | `Set[str]` |
53+
| `process_headers(headers)` | Processes headers to extract variables (internal) | `Set[str]` |
54+
| `process_request(request)` | Processes a request to extract variables (internal) | `Set[str]` |
55+
| `process_item(item)` | Processes a collection item to extract variables (internal) | `Set[str]` |
56+
57+
## Main Function
58+
59+
| Function | Description | Return Type |
60+
|----------|-------------|-------------|
61+
| `main()` | Entry point for the command-line interface | `None` |
62+
63+
## Function Dependencies
64+
65+
The following diagram shows the main function dependencies:
66+
67+
```
68+
main()
69+
├── load_config()
70+
│ └── validate_json_file()
71+
├── resolve_collection_path()
72+
├── PostmanToBurp.run()
73+
│ ├── load_collection()
74+
│ │ └── validate_json_file()
75+
│ ├── load_profile()
76+
│ │ └── validate_json_file()
77+
│ ├── check_proxy()
78+
│ │ ├── check_proxy_connection()
79+
│ │ ├── detect_running_proxy()
80+
│ │ └── verify_proxy_with_request()
81+
│ ├── process_collection()
82+
│ │ ├── extract_all_requests()
83+
│ │ │ └── extract_requests_from_item()
84+
│ │ ├── prepare_request()
85+
│ │ │ └── replace_variables()
86+
│ │ └── send_request()
87+
│ └── save_results()
88+
└── save_config()
89+
```
90+
91+
## Testing Functions
92+
93+
The test suite includes tests for all major functions to ensure they work correctly. See the [[Tests]] page for more information on the test suite.

Wiki/Overview.md renamed to Wiki/Overview/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Overview
2-
3-
## Introduction
1+
## Introducton
42

53
Postman2Burp bridges the gap between API development and security testing by automatically sending Postman collection requests through Burp Suite proxy. The tool solves the critical problem of translating existing API test collections into security testing workflows without manual recreation of complex request sequences.
64

0 commit comments

Comments
 (0)