Compare commits

...

3 Commits

Author SHA1 Message Date
Carlos Polop
21a967acb5 fix urls 2026-01-20 13:59:32 +01:00
SirBroccoli
89a55bde9b Auto-merge PR #553 (Codex) 2026-01-18 23:11:38 +00:00
SirBroccoli
54fc62d29b Auto-merge PR #552 (Codex) 2026-01-18 23:06:21 +00:00
5 changed files with 57 additions and 19 deletions

View File

@@ -10,7 +10,7 @@ jobs:
if: > if: >
${{ github.event.workflow_run.conclusion == 'failure' && ${{ github.event.workflow_run.conclusion == 'failure' &&
github.event.workflow_run.pull_requests && github.event.workflow_run.pull_requests &&
github.event.workflow_run.pull_requests[0].user.login == 'carlospolop' && github.event.workflow_run.pull_requests[0] &&
!startsWith(github.event.workflow_run.head_commit.message, 'Fix CI failures for PR #') }} !startsWith(github.event.workflow_run.head_commit.message, 'Fix CI failures for PR #') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
@@ -20,10 +20,33 @@ jobs:
actions: read actions: read
steps: steps:
- name: Comment on PR with failure info - name: Resolve PR context
uses: actions/github-script@v7 id: pr_context
env: env:
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
GH_TOKEN: ${{ github.token }}
run: |
pr_author=$(gh api -H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/pulls/${PR_NUMBER} \
--jq '.user.login')
pr_head_repo=$(gh api -H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/pulls/${PR_NUMBER} \
--jq '.head.repo.full_name')
pr_head_branch=$(gh api -H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/pulls/${PR_NUMBER} \
--jq '.head.ref')
{
echo "number=${PR_NUMBER}"
echo "author=${pr_author}"
echo "head_repo=${pr_head_repo}"
echo "head_branch=${pr_head_branch}"
} >> "$GITHUB_OUTPUT"
- name: Comment on PR with failure info
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
uses: actions/github-script@v7
env:
PR_NUMBER: ${{ steps.pr_context.outputs.number }}
RUN_URL: ${{ github.event.workflow_run.html_url }} RUN_URL: ${{ github.event.workflow_run.html_url }}
WORKFLOW_NAME: ${{ github.event.workflow_run.name }} WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
with: with:
@@ -39,19 +62,22 @@ jobs:
}); });
- name: Checkout PR head - name: Checkout PR head
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
uses: actions/checkout@v5 uses: actions/checkout@v5
with: with:
repository: ${{ github.event.workflow_run.head_repository.full_name }} repository: ${{ steps.pr_context.outputs.head_repo }}
ref: ${{ github.event.workflow_run.head_sha }} ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0 fetch-depth: 0
persist-credentials: true persist-credentials: true
- name: Configure git author - name: Configure git author
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
run: | run: |
git config user.name "codex-action" git config user.name "codex-action"
git config user.email "codex-action@users.noreply.github.com" git config user.email "codex-action@users.noreply.github.com"
- name: Fetch failure summary - name: Fetch failure summary
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
RUN_ID: ${{ github.event.workflow_run.id }} RUN_ID: ${{ github.event.workflow_run.id }}
@@ -79,10 +105,11 @@ jobs:
PY PY
- name: Create Codex prompt - name: Create Codex prompt
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
env: env:
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} PR_NUMBER: ${{ steps.pr_context.outputs.number }}
RUN_URL: ${{ github.event.workflow_run.html_url }} RUN_URL: ${{ github.event.workflow_run.html_url }}
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} HEAD_BRANCH: ${{ steps.pr_context.outputs.head_branch }}
run: | run: |
{ {
echo "You are fixing CI failures for PR #${PR_NUMBER} in ${{ github.repository }}." echo "You are fixing CI failures for PR #${PR_NUMBER} in ${{ github.repository }}."
@@ -98,6 +125,7 @@ jobs:
} > codex_prompt.txt } > codex_prompt.txt
- name: Run Codex - name: Run Codex
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
id: run_codex id: run_codex
uses: openai/codex-action@v1 uses: openai/codex-action@v1
with: with:
@@ -107,9 +135,10 @@ jobs:
model: gpt-5.2-codex model: gpt-5.2-codex
- name: Commit and push if changed - name: Commit and push if changed
if: ${{ steps.pr_context.outputs.author == 'carlospolop' }}
env: env:
TARGET_BRANCH: ${{ github.event.workflow_run.head_branch }} TARGET_BRANCH: ${{ steps.pr_context.outputs.head_branch }}
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} PR_NUMBER: ${{ steps.pr_context.outputs.number }}
run: | run: |
if git diff --quiet; then if git diff --quiet; then
echo "No changes to commit." echo "No changes to commit."
@@ -120,10 +149,10 @@ jobs:
git push origin HEAD:${TARGET_BRANCH} git push origin HEAD:${TARGET_BRANCH}
- name: Comment with Codex result - name: Comment with Codex result
if: steps.run_codex.outputs.final-message != '' if: ${{ steps.pr_context.outputs.author == 'carlospolop' && steps.run_codex.outputs.final-message != '' }}
uses: actions/github-script@v7 uses: actions/github-script@v7
env: env:
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} PR_NUMBER: ${{ steps.pr_context.outputs.number }}
CODEX_MESSAGE: ${{ steps.run_codex.outputs.final-message }} CODEX_MESSAGE: ${{ steps.run_codex.outputs.final-message }}
with: with:
github-token: ${{ github.token }} github-token: ${{ github.token }}

View File

@@ -17,9 +17,9 @@ check_external_hostname(){
INTERNET_SEARCH_TIMEOUT=15 INTERNET_SEARCH_TIMEOUT=15
# wget or curl? # wget or curl?
if command -v curl >/dev/null 2>&1; then if command -v curl >/dev/null 2>&1; then
curl "https://2e6ppt7izvuv66qmx2r3et2ufi0mxwqs.lambda-url.us-east-1.on.aws/" -H "User-Agent: linpeas" -d "{\"hostname\":\"$(hostname)\"}" -H "Content-Type: application/json" --max-time "$INTERNET_SEARCH_TIMEOUT" curl "https://tools.hacktricks.wiki/api/host-checker" -H "User-Agent: linpeas" -d "{\"hostname\":\"$(hostname)\"}" -H "Content-Type: application/json" --max-time "$INTERNET_SEARCH_TIMEOUT"
elif command -v wget >/dev/null 2>&1; then elif command -v wget >/dev/null 2>&1; then
wget -q -O - "https://2e6ppt7izvuv66qmx2r3et2ufi0mxwqs.lambda-url.us-east-1.on.aws/" --header "User-Agent: linpeas" --post-data "{\"hostname\":\"$(hostname)\"}" -H "Content-Type: application/json" --timeout "$INTERNET_SEARCH_TIMEOUT" wget -q -O - "https://tools.hacktricks.wiki/api/host-checker" --header "User-Agent: linpeas" --post-data "{\"hostname\":\"$(hostname)\"}" -H "Content-Type: application/json" --timeout "$INTERNET_SEARCH_TIMEOUT"
else else
echo "wget or curl not found" echo "wget or curl not found"
fi fi

View File

@@ -15,11 +15,12 @@
check_tcp_443_bin () { check_tcp_443_bin () {
local TIMEOUT_INTERNET_SECONDS_443_BIN=$1 local TIMEOUT_INTERNET_SECONDS_443_BIN=$1
local url_lambda="https://2e6ppt7izvuv66qmx2r3et2ufi0mxwqs.lambda-url.us-east-1.on.aws/" local url_lambda="https://tools.hacktricks.wiki/api/host-checker"
if command -v curl >/dev/null 2>&1; then if command -v curl >/dev/null 2>&1; then
if curl -s --connect-timeout $TIMEOUT_INTERNET_SECONDS_443_BIN "$url_lambda" \ if curl -s --connect-timeout $TIMEOUT_INTERNET_SECONDS_443_BIN "$url_lambda" \
-H "User-Agent: linpeas" -H "Content-Type: application/json" >/dev/null 2>&1 -H "User-Agent: linpeas" -H "Content-Type: application/json" \
-d "{\"hostname\":\"$(hostname)\"}" >/dev/null 2>&1
then then
echo "Port 443 is accessible with curl" echo "Port 443 is accessible with curl"
return 0 # ✅ success return 0 # ✅ success
@@ -30,7 +31,8 @@ check_tcp_443_bin () {
elif command -v wget >/dev/null 2>&1; then elif command -v wget >/dev/null 2>&1; then
if wget -q --timeout=$TIMEOUT_INTERNET_SECONDS_443_BIN -O - "$url_lambda" \ if wget -q --timeout=$TIMEOUT_INTERNET_SECONDS_443_BIN -O - "$url_lambda" \
--header "User-Agent: linpeas" -H "Content-Type: application/json" >/dev/null 2>&1 --header "User-Agent: linpeas" -H "Content-Type: application/json" \
--post-data "{\"hostname\":\"$(hostname)\"}" >/dev/null 2>&1
then then
echo "Port 443 is accessible with wget" echo "Port 443 is accessible with wget"
return 0 return 0

View File

@@ -46,7 +46,7 @@ namespace winPEAS.Info.NetworkInfo
// 4. Call external checker // 4. Call external checker
var resp = httpClient var resp = httpClient
.PostAsync("https://2e6ppt7izvuv66qmx2r3et2ufi0mxwqs.lambda-url.us-east-1.on.aws/", payload) .PostAsync("https://tools.hacktricks.wiki/api/host-checker", payload)
.GetAwaiter().GetResult(); .GetAwaiter().GetResult();
if (resp.IsSuccessStatusCode) if (resp.IsSuccessStatusCode)

View File

@@ -4,6 +4,8 @@ using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text;
using System.Text.Json;
using System.Threading; using System.Threading;
namespace winPEAS.Info.NetworkInfo namespace winPEAS.Info.NetworkInfo
@@ -48,7 +50,7 @@ namespace winPEAS.Info.NetworkInfo
{ "1.1.1.1", "8.8.8.8" }; { "1.1.1.1", "8.8.8.8" };
private const string LAMBDA_URL = private const string LAMBDA_URL =
"https://2e6ppt7izvuv66qmx2r3et2ufi0mxwqs.lambda-url.us-east-1.on.aws/"; "https://tools.hacktricks.wiki/api/host-checker";
// Shared HttpClient (kept for HTTP & Lambda checks) // Shared HttpClient (kept for HTTP & Lambda checks)
private static readonly HttpClient http = new HttpClient private static readonly HttpClient http = new HttpClient
@@ -118,7 +120,12 @@ namespace winPEAS.Info.NetworkInfo
using var cts = using var cts =
new CancellationTokenSource(TimeSpan.FromMilliseconds(HTTP_TIMEOUT_MS)); new CancellationTokenSource(TimeSpan.FromMilliseconds(HTTP_TIMEOUT_MS));
var req = new HttpRequestMessage(HttpMethod.Get, LAMBDA_URL); var payload = new StringContent(
JsonSerializer.Serialize(new { hostname = Environment.MachineName }),
Encoding.UTF8,
"application/json");
var req = new HttpRequestMessage(HttpMethod.Post, LAMBDA_URL);
req.Content = payload;
req.Headers.UserAgent.ParseAdd("winpeas"); req.Headers.UserAgent.ParseAdd("winpeas");
req.Headers.Accept.Add( req.Headers.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json")); new MediaTypeWithQualityHeaderValue("application/json"));