Skip to content

Commit 568e1b7

Browse files
Merge branch 'hackvertor-master'
2 parents 48bd457 + a61e96d commit 568e1b7

53 files changed

Lines changed: 6275 additions & 733 deletions

Some content is hidden

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

.classpath

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
<classpath>
33
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5-
<classpathentry kind="lib" path="/opt/burp/burpsuite_pro_v1.6.24.jar"/>
65
<classpathentry kind="output" path="bin"/>
76
</classpath>

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: hackvertor

.github/workflows/maven.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
name: Release on Version Change
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths:
9+
- 'src/main/java/burp/hv/HackvertorExtension.java'
10+
11+
jobs:
12+
check-version:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.extract_version.outputs.version }}
16+
version_changed: ${{ steps.check_version.outputs.changed }}
17+
tag_exists: ${{ steps.check_tag.outputs.tag_exists }}
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Extract current version
26+
id: extract_version
27+
run: |
28+
VERSION=$(grep -E '^\s*public static String version = "v[0-9]+\.[0-9]+\.[0-9]+";' src/main/java/burp/hv/HackvertorExtension.java | sed -E 's/.*"(v[0-9]+\.[0-9]+\.[0-9]+)".*/\1/')
29+
echo "version=$VERSION" >> $GITHUB_OUTPUT
30+
echo "Current version: $VERSION"
31+
32+
- name: Check if version changed
33+
id: check_version
34+
run: |
35+
# Get the previous version from the last commit
36+
git show HEAD~1:src/main/java/burp/hv/HackvertorExtension.java > prev_file.java 2>/dev/null || echo "File not found in previous commit"
37+
38+
if [ -f prev_file.java ]; then
39+
PREV_VERSION=$(grep -E '^\s*public static String version = "v[0-9]+\.[0-9]+\.[0-9]+";' prev_file.java | sed -E 's/.*"(v[0-9]+\.[0-9]+\.[0-9]+)".*/\1/' || echo "none")
40+
else
41+
PREV_VERSION="none"
42+
fi
43+
44+
CURRENT_VERSION="${{ steps.extract_version.outputs.version }}"
45+
46+
echo "Previous version: $PREV_VERSION"
47+
echo "Current version: $CURRENT_VERSION"
48+
49+
if [ "$PREV_VERSION" != "$CURRENT_VERSION" ]; then
50+
echo "Version changed from $PREV_VERSION to $CURRENT_VERSION"
51+
echo "changed=true" >> $GITHUB_OUTPUT
52+
else
53+
echo "Version unchanged"
54+
echo "changed=false" >> $GITHUB_OUTPUT
55+
fi
56+
57+
- name: Check if tag exists
58+
if: steps.check_version.outputs.changed == 'true'
59+
id: check_tag
60+
run: |
61+
VERSION="${{ steps.extract_version.outputs.version }}"
62+
if git rev-parse "$VERSION" >/dev/null 2>&1; then
63+
echo "Tag $VERSION already exists, skipping release"
64+
echo "tag_exists=true" >> $GITHUB_OUTPUT
65+
else
66+
echo "Tag $VERSION does not exist, proceeding with release"
67+
echo "tag_exists=false" >> $GITHUB_OUTPUT
68+
fi
69+
70+
build-and-release:
71+
needs: check-version
72+
if: needs.check-version.outputs.version_changed == 'true' && needs.check-version.outputs.tag_exists != 'true'
73+
runs-on: ubuntu-latest
74+
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v4
78+
79+
- name: Set up JDK 17
80+
uses: actions/setup-java@v4
81+
with:
82+
java-version: '17'
83+
distribution: 'temurin'
84+
85+
- name: Grant execute permission for gradlew
86+
run: chmod +x gradlew
87+
88+
- name: Setup virtual display for UI tests
89+
run: |
90+
sudo apt-get update
91+
sudo apt-get install -y xvfb
92+
export DISPLAY=:99
93+
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
94+
echo "DISPLAY=:99" >> $GITHUB_ENV
95+
96+
- name: Run all tests
97+
run: |
98+
echo "Running all tests before release..."
99+
# Run tests with virtual display
100+
xvfb-run -a ./gradlew test --info
101+
if [ $? -ne 0 ]; then
102+
echo "Tests failed! Aborting release."
103+
exit 1
104+
fi
105+
echo "All tests passed successfully!"
106+
107+
- name: Build with Gradle
108+
run: ./gradlew shadowJar
109+
110+
- name: List build artifacts
111+
run: |
112+
echo "Contents of releases directory:"
113+
ls -la releases/ || echo "releases directory not found"
114+
115+
- name: Get JAR filename
116+
id: get_jar
117+
run: |
118+
# The JAR is output to releases/ directory according to build.gradle
119+
JAR_FILE="releases/hackvertor-all.jar"
120+
if [ ! -f "$JAR_FILE" ]; then
121+
echo "Error: JAR file not found at $JAR_FILE"
122+
echo "Checking releases directory:"
123+
ls -la releases/ || echo "releases directory not found"
124+
exit 1
125+
fi
126+
JAR_NAME=$(basename "$JAR_FILE")
127+
echo "jar_file=$JAR_FILE" >> $GITHUB_OUTPUT
128+
echo "jar_name=$JAR_NAME" >> $GITHUB_OUTPUT
129+
echo "Found JAR: $JAR_NAME at $JAR_FILE"
130+
131+
- name: Rename JAR for release
132+
run: |
133+
cp "${{ steps.get_jar.outputs.jar_file }}" "hackvertor-${{ needs.check-version.outputs.version }}.jar"
134+
echo "Release JAR created: hackvertor-${{ needs.check-version.outputs.version }}.jar"
135+
136+
- name: Create Release and Upload Asset
137+
uses: softprops/action-gh-release@v1
138+
with:
139+
tag_name: ${{ needs.check-version.outputs.version }}
140+
name: Hackvertor ${{ needs.check-version.outputs.version }}
141+
body: |
142+
## Hackvertor ${{ needs.check-version.outputs.version }}
143+
144+
### Installation
145+
Download the JAR file below and add it to Burp Suite via:
146+
- Extender/Extensions tab → Add → Select the downloaded JAR file
147+
148+
### Changes
149+
See [commit history](https://github.com/${{ github.repository }}/commits/${{ needs.check-version.outputs.version }}) for details.
150+
draft: false
151+
prerelease: false
152+
files: |
153+
hackvertor-${{ needs.check-version.outputs.version }}.jar
154+
env:
155+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156+
157+
cleanup-old-releases:
158+
needs: build-and-release
159+
runs-on: ubuntu-latest
160+
161+
steps:
162+
- name: Checkout code
163+
uses: actions/checkout@v4
164+
165+
- name: Delete old releases
166+
uses: actions/github-script@v7
167+
with:
168+
github-token: ${{ secrets.GITHUB_TOKEN }}
169+
script: |
170+
const { owner, repo } = context.repo;
171+
172+
// Get all releases sorted by created date (newest first)
173+
const releases = await github.rest.repos.listReleases({
174+
owner,
175+
repo,
176+
per_page: 100
177+
});
178+
179+
console.log(`Found ${releases.data.length} total releases`);
180+
181+
// Keep only the 5 most recent releases
182+
const maxReleases = 5;
183+
184+
if (releases.data.length > maxReleases) {
185+
// Sort releases by created_at date (newest first)
186+
const sortedReleases = releases.data.sort((a, b) =>
187+
new Date(b.created_at) - new Date(a.created_at)
188+
);
189+
190+
// Get releases to delete (all except the most recent 5)
191+
const releasesToDelete = sortedReleases.slice(maxReleases);
192+
193+
console.log(`Keeping ${maxReleases} most recent releases`);
194+
console.log(`Deleting ${releasesToDelete.length} old releases`);
195+
196+
for (const release of releasesToDelete) {
197+
try {
198+
console.log(`Deleting release: ${release.name} (${release.tag_name})`);
199+
200+
// Delete the release
201+
await github.rest.repos.deleteRelease({
202+
owner,
203+
repo,
204+
release_id: release.id
205+
});
206+
207+
// Delete the associated tag
208+
try {
209+
await github.rest.git.deleteRef({
210+
owner,
211+
repo,
212+
ref: `tags/${release.tag_name}`
213+
});
214+
console.log(`Deleted tag: ${release.tag_name}`);
215+
} catch (tagError) {
216+
console.log(`Could not delete tag ${release.tag_name}: ${tagError.message}`);
217+
}
218+
219+
} catch (error) {
220+
console.error(`Failed to delete release ${release.name}: ${error.message}`);
221+
}
222+
}
223+
224+
console.log('Cleanup completed');
225+
} else {
226+
console.log(`Only ${releases.data.length} releases exist, no cleanup needed`);
227+
}

0 commit comments

Comments
 (0)