mirror of
https://github.com/peass-ng/PEASS-ng.git
synced 2026-01-19 08:11:20 -08:00
Compare commits
4 Commits
fix-pr-fai
...
fix-pr-fai
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4155093e56 | ||
|
|
be1b0cdbd0 | ||
|
|
4308caddf1 | ||
|
|
54fc62d29b |
51
.github/workflows/pr-failure-codex-dispatch.yml
vendored
51
.github/workflows/pr-failure-codex-dispatch.yml
vendored
@@ -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,23 +135,26 @@ 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."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
rm -f codex_failure_summary.txt codex_prompt.txt
|
||||||
git add -A
|
git add -A
|
||||||
|
git reset -- codex_failure_summary.txt codex_prompt.txt
|
||||||
git commit -m "Fix CI failures for PR #${PR_NUMBER}"
|
git commit -m "Fix CI failures for PR #${PR_NUMBER}"
|
||||||
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 }}
|
||||||
|
|||||||
@@ -19,6 +19,16 @@ print_info "https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation
|
|||||||
if [ "$PASSWORD" ]; then
|
if [ "$PASSWORD" ]; then
|
||||||
(echo "$PASSWORD" | timeout 1 sudo -S -l | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW}," | sed -${E} "s,$sudoB,${SED_RED},g") 2>/dev/null || echo_not_found "sudo"
|
(echo "$PASSWORD" | timeout 1 sudo -S -l | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW}," | sed -${E} "s,$sudoB,${SED_RED},g") 2>/dev/null || echo_not_found "sudo"
|
||||||
fi
|
fi
|
||||||
|
(sudo -n -l 2>/dev/null | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW}," | sed -${E} "s,$sudoB,${SED_RED},g" | sed "s,\!root,${SED_RED},") 2>/dev/null || echo "No cached sudo token (sudo -n -l)"
|
||||||
|
|
||||||
|
secure_path_line=$(sudo -l 2>/dev/null | grep -o "secure_path=[^,]*" | head -n 1 | cut -d= -f2)
|
||||||
|
if [ "$secure_path_line" ]; then
|
||||||
|
for p in $(echo "$secure_path_line" | tr ':' ' '); do
|
||||||
|
if [ -w "$p" ]; then
|
||||||
|
echo "Writable secure_path entry: $p" | sed -${E} "s,.*,${SED_RED},g"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
( grep -Iv "^$" cat /etc/sudoers | grep -v "#" | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW}," | sed -${E} "s,$sudoB,${SED_RED},g" | sed "s,pwfeedback,${SED_RED},g" ) 2>/dev/null || echo_not_found "/etc/sudoers"
|
( grep -Iv "^$" cat /etc/sudoers | grep -v "#" | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW}," | sed -${E} "s,$sudoB,${SED_RED},g" | sed "s,pwfeedback,${SED_RED},g" ) 2>/dev/null || echo_not_found "/etc/sudoers"
|
||||||
if ! [ "$IAMROOT" ] && [ -w '/etc/sudoers.d/' ]; then
|
if ! [ "$IAMROOT" ] && [ -w '/etc/sudoers.d/' ]; then
|
||||||
echo "You can create a file in /etc/sudoers.d/ and escalate privileges" | sed -${E} "s,.*,${SED_RED_YELLOW},"
|
echo "You can create a file in /etc/sudoers.d/ and escalate privileges" | sed -${E} "s,.*,${SED_RED_YELLOW},"
|
||||||
@@ -29,4 +39,4 @@ for f in /etc/sudoers.d/*; do
|
|||||||
grep -Iv "^$" "$f" | grep -v "#" | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW}," | sed -${E} "s,$sudoB,${SED_RED},g" | sed "s,pwfeedback,${SED_RED},g"
|
grep -Iv "^$" "$f" | grep -v "#" | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW}," | sed -${E} "s,$sudoB,${SED_RED},g" | sed "s,pwfeedback,${SED_RED},g"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -40,4 +40,18 @@ else
|
|||||||
echo "ptrace protection is enabled ($ptrace_scope)" | sed "s,is enabled,${SED_GREEN},g";
|
echo "ptrace protection is enabled ($ptrace_scope)" | sed "s,is enabled,${SED_GREEN},g";
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -d "/var/run/sudo/ts" ]; then
|
||||||
|
echo "Sudo token directory perms:" | sed -${E} "s,.*,${SED_LIGHT_CYAN},g"
|
||||||
|
ls -ld /var/run/sudo/ts 2>/dev/null
|
||||||
|
if [ -w "/var/run/sudo/ts" ]; then
|
||||||
|
echo "/var/run/sudo/ts is writable" | sed -${E} "s,.*,${SED_RED},g"
|
||||||
|
fi
|
||||||
|
if [ -f "/var/run/sudo/ts/$USER" ]; then
|
||||||
|
ls -l "/var/run/sudo/ts/$USER" 2>/dev/null
|
||||||
|
if [ -w "/var/run/sudo/ts/$USER" ]; then
|
||||||
|
echo "User sudo token file is writable" | sed -${E} "s,.*,${SED_RED},g"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -13,5 +13,5 @@
|
|||||||
# Small linpeas: 1
|
# Small linpeas: 1
|
||||||
|
|
||||||
|
|
||||||
sudoVB1=" \*|env_keep\W*\+=.*LD_PRELOAD|env_keep\W*\+=.*LD_LIBRARY_PATH|env_keep\W*\+=.*BASH_ENV|env_keep\W*\+=.* ENV|peass{SUDOVB1_HERE}"
|
sudoVB1=" \*|env_keep\W*\+=.*LD_PRELOAD|env_keep\W*\+=.*LD_LIBRARY_PATH|env_keep\W*\+=.*BASH_ENV|env_keep\W*\+=.* ENV|env_keep\W*\+=.*PATH|!env_reset|!requiretty|peass{SUDOVB1_HERE}"
|
||||||
sudoVB2="peass{SUDOVB2_HERE}"
|
sudoVB2="peass{SUDOVB2_HERE}"
|
||||||
|
|||||||
Reference in New Issue
Block a user