Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hey bot #2

Open
injoon5 opened this issue Sep 11, 2020 · 4 comments
Open

hey bot #2

injoon5 opened this issue Sep 11, 2020 · 4 comments

Comments

@injoon5
Copy link
Owner

injoon5 commented Sep 11, 2020

@github-actions run

await fetch("https://example.com")
@injoon5
Copy link
Owner Author

injoon5 commented Sep 11, 2020

@github-actions run

LGTM 👍
const res = await fetch("https://lgtm.in/g", {
  redirect: 'manual'
});
const webSiteUrl = res.headers.get('location');
const picUrl = new URL(webSiteUrl);
picUrl.pathname = picUrl.pathname.replace("/i/", "/p/");
postComment(`![LGTM](${picUrl.href})`);

@injoon5
Copy link
Owner Author

injoon5 commented Sep 11, 2020

LGTM

@injoon5
Copy link
Owner Author

injoon5 commented Sep 11, 2020

@github-actions run

🌐 SSH debug over Piping Server
const pathLen = 64;
const aPath = randomString(pathLen);
const bPath = randomString(pathLen);

console.log(execSync(`
chmod 755 "$HOME"
ls -lA /home
authorized_keys_file="$(sshd -T 2>/dev/null | grep -E '^authorizedkeysfile ' | cut -d ' ' -f 2)"
authorized_keys_file="$(cd && realpath -m "$authorized_keys_file")"
sshd_config_dir="$(dirname "$authorized_keys_file")"
(umask 0077 && mkdir "$sshd_config_dir")
echo $authorized_keys_file;

# (from: https://qiita.com/zackey2/items/429c77e5780ba8bc1bf9#authorized_keys%E3%81%AB%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95)
(echo; curl https://github.com/nwtgck.keys; echo) >> ~/.ssh/authorized_keys

sudo apt install -y socat;
`).toString());

// Comment new session
const commentBody = `\
## 🌐 New SSH session
Run the commands below in different terminals.

\`\`\`bash
socat TCP-LISTEN:31376 'EXEC:curl -NsS https\\://ppng.io/${bPath}!!EXEC:curl -NsST - https\\://ppng.io/${aPath}'
\`\`\`

\`\`\`bash
ssh-keygen -R '[localhost]:31376'
ssh -p 31376 runner@localhost
\`\`\`

`;
await githubClient.issues.createComment({
  issue_number: context.issue.number,
  owner: context.repo.owner,
  repo: context.repo.repo,
  body: commentBody
});

execSync(`socat 'EXEC:curl -NsS https\\://ppng.io/${aPath}!!EXEC:curl -NsST - https\\://ppng.io/${bPath}' TCP:127.0.0.1:22`);

// (from: https://stackoverflow.com/a/1349426/2885946)
function randomString(length) {
  let result           = '';
  const characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  const charactersLength = characters.length;
  for ( var i = 0; i < length; i++ ) {
    result += characters.charAt(Math.floor(Math.random() * charactersLength));
  }
  return result;
}

References

Thanks Cryolite!

@injoon5
Copy link
Owner Author

injoon5 commented Mar 1, 2021

@github-actions run

await fetch("https://example.com")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant