-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Android Deep Link QR Generator Module #20668
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
Open
ctkqiang
wants to merge
4
commits into
rapid7:master
Choose a base branch
from
ctkqiang:ctkqiang-feat/mod/android_deeplink
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
012a948
added the basic and necessary functions
ctkqiang c95204f
Feat: Enhance Android Deep Link QR Code Generator with expanded schem…
ctkqiang 81128a0
Feat: Enhance Android Deep Link QR Code Generator with expanded schem…
ctkqiang 238a25d
Add Android deep link QR generator for mobile app security testing
ctkqiang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,3 +55,6 @@ group :test do | |
| gem 'timecop' | ||
| end | ||
|
|
||
|
|
||
| gem "rqrcode", "~> 3.1" | ||
| gem "chunky_png", "~> 1.4" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,252 @@ | ||
| require 'msf/core' | ||
|
|
||
| class MetasploitModule < Msf::Auxiliary | ||
| include Msf::Exploit::FILEFORMAT | ||
|
|
||
| # How to use this module: | ||
| # | ||
| # Search: `search android_deeplink` to check for module | ||
| # 1. Load the module: | ||
| # 2. Set the deep link scheme (like for Wechat lets say): | ||
| # `use auxiliary/generator/android_deeplink` | ||
| # | ||
| # `set DEEPLINK_SCHEME weixin://` | ||
| # | ||
| # 3. Set the deep link path : | ||
| # `set DEEPLINK_PATH dl/scanqr?type=qr ` | ||
| # | ||
| # 4. Specify the output filename for the generated QR code: | ||
| # `set FILENAME wechat_qr.png` | ||
| # | ||
| # 5. Run the module to generate the QR code: | ||
| # `run` | ||
|
|
||
| def initialize(info = {}) | ||
| super(update_info(info, | ||
| 'Name' => 'Android Deep Link QR Code Payload Generator', | ||
| 'Description' => %q{ | ||
| This module make QR code with Android Deep Link. | ||
| When user scan QR, phone open app with deep link. | ||
| Can use for test app security or social engineering. | ||
| }, | ||
| 'Author' => [ 'ctkqiang' ], | ||
| 'License' => MSF_LICENSE | ||
| )) | ||
|
|
||
| register_options([ | ||
| OptEnum.new('DEEPLINK_SCHEME', [true, 'Choose deep link scheme', 'weixin://', [ | ||
| 'weixin://', | ||
| 'grab://', | ||
| 'boost://', | ||
| 'alipay://', | ||
| 'fb://', | ||
| 'instagram://', | ||
| 'twitter://', | ||
| 'line://', | ||
| 'telegram://', | ||
| 'whatsapp://', | ||
| 'tiktok://', | ||
| 'shopee://', | ||
| 'lazada://', | ||
| 'gpay://', | ||
| 'applepay://', | ||
| 'youtube://', | ||
| 'spotify://', | ||
| 'linkedin://', | ||
| 'pinterest://', | ||
| 'snapchat://', | ||
| 'paypal://', | ||
| 'skype://', | ||
| 'discord://', | ||
| 'slack://', | ||
| 'zoomus://', | ||
| 'meet://', | ||
| 'waze://', | ||
| 'maps://', | ||
| 'uber://', | ||
| 'lyft://', | ||
| 'cameraplus://', | ||
| 'vimeo://', | ||
| 'tumblr://', | ||
| 'reddit://', | ||
| 'hulu://', | ||
| 'netflix://', | ||
| 'soundcloud://', | ||
| 'deezer://', | ||
| 'tidal://', | ||
| 'messenger://', | ||
| 'fb-messenger://', | ||
| 'skype-for-business://', | ||
| 'teams://', | ||
| 'onedrive://', | ||
| 'dropbox://', | ||
| 'box://', | ||
| 'zoom://', | ||
| 'twitch://', | ||
| 'quora://', | ||
| 'medium://', | ||
| 'goodreads://', | ||
| 'yelp://', | ||
| 'tripadvisor://', | ||
| 'booking://', | ||
| 'airbnb://', | ||
| 'grabpay://', | ||
| 'wechatpay://', | ||
| 'ocbc://', | ||
| 'maybank2u://', | ||
| 'rhb://', | ||
| 'cimb://', | ||
| 'dbs://', | ||
| 'hsbc://', | ||
| 'standardchartered://', | ||
| 'custom://' | ||
| ]]), | ||
| OptString.new('CUSTOM_SCHEME', [false, 'If choose custom, put scheme here', 'myapp://']), | ||
| OptString.new('DEEPLINK_PATH', [false, 'Deep link path and parameters', 'pay?amount=100']), | ||
| OptString.new('FILENAME', [true, 'QR code output file', 'deeplink_qr.png']), | ||
| OptInt.new('SIZE', [true, 'QR code size in pixel', 400]) | ||
| ]) | ||
| end | ||
|
|
||
| def run | ||
|
|
||
| begin | ||
| require 'rqrcode' | ||
| require 'chunky_png' | ||
| gems_available = true | ||
| rescue LoadError | ||
| gems_available = false | ||
| end | ||
|
|
||
| unless gems_available | ||
| print_error("Required gems not found. Please install them with:") | ||
| print_error("gem install rqrcode chunky_png") | ||
| print_error("Then restart msfconsole and try again.") | ||
| return | ||
| end | ||
|
|
||
| scheme = datastore['DEEPLINK_SCHEME'] | ||
|
|
||
| if scheme == 'custom://' | ||
| custom_scheme = datastore['CUSTOM_SCHEME'] | ||
| if custom_scheme.empty? | ||
| print_error("Please set CUSTOM_SCHEME option") | ||
| return | ||
| end | ||
|
|
||
| scheme = custom_scheme | ||
| end | ||
|
|
||
| path = datastore['DEEPLINK_PATH'] || "" | ||
|
|
||
| if path.empty? | ||
| target_deep_link = scheme | ||
| else | ||
| if path.start_with?('/') | ||
| target_deep_link = scheme + path | ||
| else | ||
| target_deep_link = scheme + '/' + path | ||
| end | ||
| end | ||
|
|
||
| print_status("Start generate QR code for deep link...") | ||
| print_status("Deep Link: #{target_deep_link}") | ||
|
|
||
| app_name = get_app_name(scheme) | ||
|
|
||
| print_status("This deep link will open: #{app_name}") | ||
|
|
||
| begin | ||
| generate_qr_code(target_deep_link) | ||
| print_good("QR code generate success: #{datastore['FILENAME']}") | ||
| print_warning("When user scan this QR, #{app_name} will open with deep link") | ||
|
|
||
| rescue => e | ||
| print_error("Generate QR code fail: #{e.message}") | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def generate_qr_code(url) | ||
| qrcode = RQRCode::QRCode.new(url) | ||
|
|
||
| png = qrcode.as_png( | ||
| size: datastore['SIZE'], | ||
| border_modules: 1, | ||
| module_px_size: 6, | ||
| fill: 'white', | ||
| color: 'black' | ||
| ) | ||
|
|
||
| File.binwrite(datastore['FILENAME'], png.to_s) | ||
| end | ||
|
|
||
| def get_app_name(scheme) | ||
| case scheme | ||
| when 'weixin://' then 'WeChat' | ||
| when 'grab://' then 'Grab' | ||
| when 'boost://' then 'Boost' | ||
| when 'alipay://' then 'Alipay' | ||
| when 'fb://' then 'Facebook' | ||
| when 'instagram://' then 'Instagram' | ||
| when 'twitter://' then 'Twitter' | ||
| when 'line://' then 'LINE' | ||
| when 'telegram://' then 'Telegram' | ||
| when 'whatsapp://' then 'WhatsApp' | ||
| when 'tiktok://' then 'TikTok' | ||
| when 'shopee://' then 'Shopee' | ||
| when 'lazada://' then 'Lazada' | ||
| when 'gpay://' then 'Google Pay' | ||
| when 'applepay://' then 'Apple Pay' | ||
| when 'youtube://' then 'YouTube' | ||
| when 'spotify://' then 'Spotify' | ||
| when 'linkedin://' then 'LinkedIn' | ||
| when 'pinterest://' then 'Pinterest' | ||
| when 'snapchat://' then 'Snapchat' | ||
| when 'paypal://' then 'PayPal' | ||
| when 'skype://' then 'Skype' | ||
| when 'discord://' then 'Discord' | ||
| when 'slack://' then 'Slack' | ||
| when 'zoomus://', 'zoom://' then 'Zoom' | ||
| when 'meet://' then 'Google Meet' | ||
| when 'waze://' then 'Waze' | ||
| when 'maps://' then 'Maps' | ||
| when 'uber://' then 'Uber' | ||
| when 'lyft://' then 'Lyft' | ||
| when 'cameraplus://' then 'Camera+' | ||
| when 'vimeo://' then 'Vimeo' | ||
| when 'tumblr://' then 'Tumblr' | ||
| when 'reddit://' then 'Reddit' | ||
| when 'hulu://' then 'Hulu' | ||
| when 'netflix://' then 'Netflix' | ||
| when 'soundcloud://' then 'SoundCloud' | ||
| when 'deezer://' then 'Deezer' | ||
| when 'tidal://' then 'Tidal' | ||
| when 'messenger://', 'fb-messenger://' then 'Messenger' | ||
| when 'skype-for-business://' then 'Skype for Business' | ||
| when 'teams://' then 'Microsoft Teams' | ||
| when 'onedrive://' then 'OneDrive' | ||
| when 'dropbox://' then 'Dropbox' | ||
| when 'box://' then 'Box' | ||
| when 'twitch://' then 'Twitch' | ||
| when 'quora://' then 'Quora' | ||
| when 'medium://' then 'Medium' | ||
| when 'goodreads://' then 'Goodreads' | ||
| when 'yelp://' then 'Yelp' | ||
| when 'tripadvisor://' then 'Tripadvisor' | ||
| when 'booking://' then 'Booking.com' | ||
| when 'airbnb://' then 'Airbnb' | ||
| when 'grabpay://' then 'GrabPay' | ||
| when 'wechatpay://' then 'WeChat Pay' | ||
| when 'ocbc://' then 'OCBC Bank' | ||
| when 'maybank2u://' then 'Maybank2u' | ||
| when 'rhb://' then 'RHB Bank' | ||
| when 'cimb://' then 'CIMB Bank' | ||
| when 'dbs://' then 'DBS Bank' | ||
| when 'hsbc://' then 'HSBC' | ||
| when 'standardchartered://' then 'Standard Chartered' | ||
| else 'Unknown App' | ||
| end | ||
| end | ||
| end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.