Module: Msf::Exploit::Remote::HTTP::Gitea::Helpers
- Included in:
- Msf::Exploit::Remote::HTTP::Gitea
- Defined in:
- lib/msf/core/exploit/remote/http/gitea/helpers.rb
Class Method Summary collapse
-
.gitea_get_csrf(res) ⇒ String?
Returns CSRF token string for Gitea session.
-
.gitea_get_repo_uid(res) ⇒ String?
Returns string for Gitea repository uid.
-
.gitea_get_service_type_uri(res) ⇒ String?
Returns string for Gitea service type uri.
-
.gitea_helper_login_post_data(user, pass, csrf) ⇒ Hash
Returns the POST data for a Gitea login request.
-
.gitea_helper_repo_create_post_data(name, uid, csrf) ⇒ Hash
Returns the POST data for a Gitea create repository request.
-
.gitea_helper_repo_migrate_post_data(name, uid, service, url, token, csrf) ⇒ Hash
Returns the POST data for a Gitea migrate repository request.
-
.gitea_helper_repo_remove_post_data(name, csrf) ⇒ Hash
Returns the POST data for a Gitea remove repository request.
Class Method Details
.gitea_get_csrf(res) ⇒ String?
Returns CSRF token string for Gitea session
12 13 14 |
# File 'lib/msf/core/exploit/remote/http/gitea/helpers.rb', line 12 def gitea_get_csrf(res) res&.get_html_document&.at('//input[@name="_csrf"]/@value')&.text end |
.gitea_get_repo_uid(res) ⇒ String?
Returns string for Gitea repository uid
20 21 22 |
# File 'lib/msf/core/exploit/remote/http/gitea/helpers.rb', line 20 def gitea_get_repo_uid(res) res&.get_html_document&.at('//input[@id="uid"]/@value')&.text end |
.gitea_get_service_type_uri(res) ⇒ String?
Returns string for Gitea service type uri
28 29 30 |
# File 'lib/msf/core/exploit/remote/http/gitea/helpers.rb', line 28 def gitea_get_service_type_uri(res) res&.get_html_document&.at('//svg[@class="svg gitea-gitea"]/ancestor::a/@href')&.text end |
.gitea_helper_login_post_data(user, pass, csrf) ⇒ Hash
Returns the POST data for a Gitea login request
38 39 40 41 42 43 44 |
# File 'lib/msf/core/exploit/remote/http/gitea/helpers.rb', line 38 def gitea_helper_login_post_data(user, pass, csrf) { 'user_name' => user, 'password' => pass, '_csrf' => csrf } end |
.gitea_helper_repo_create_post_data(name, uid, csrf) ⇒ Hash
Returns the POST data for a Gitea create repository request
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/msf/core/exploit/remote/http/gitea/helpers.rb', line 52 def gitea_helper_repo_create_post_data(name, uid, csrf) { 'uid' => uid, 'auto_init' => 'on', 'readme' => 'Default', 'repo_name' => name, 'trust_model' => 'default', 'default_branch' => 'master', '_csrf' => csrf } end |
.gitea_helper_repo_migrate_post_data(name, uid, service, url, token, csrf) ⇒ Hash
Returns the POST data for a Gitea migrate repository request
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/msf/core/exploit/remote/http/gitea/helpers.rb', line 86 def gitea_helper_repo_migrate_post_data(name, uid, service, url, token, csrf) { 'uid' => uid, 'service' => service, 'pull_requests' => 'on', 'repo_name' => name, '_csrf' => csrf, 'auth_token' => token, 'clone_addr' => url } end |
.gitea_helper_repo_remove_post_data(name, csrf) ⇒ Hash
Returns the POST data for a Gitea remove repository request
69 70 71 72 73 74 75 |
# File 'lib/msf/core/exploit/remote/http/gitea/helpers.rb', line 69 def gitea_helper_repo_remove_post_data(name, csrf) { 'action' => 'delete', 'repo_name' => name, '_csrf' => csrf } end |