• Stars
    star
    140
  • Rank 261,473 (Top 6 %)
  • Language
  • Created over 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The mobile hackers' guide to Charles Proxy πŸ‘

Charles Proxy Mobile Guide

The mobile hackers' guide to Charles Proxy πŸ‘

Intro

Charles is an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP and SSL / HTTPS traffic between their machine and the Internet. This includes requests, responses and the HTTP headers (which contain the cookies and caching information).

SSL Proxying

Computer (macOS)

  • Charles -> Proxy -> SSL Proxying Settings... -> SSL Proxying

    • Check "Enable SSL Proxying"
    • Add location matcher "Host: *", "Port: *"
  • Charles -> Help -> SSL Proxying -> Install Charles Root Certificate

    • It would install the certificate to Keychain, and open it up automatically
    • Double click the certificate in Keychain
    • Expand Trust, select Always Trust for When using this certificate
  • Get the IP address that Charles is listening to

    • Charles -> Help -> Local IP Address
    • Or get the WLAN IP address via command line (right into your clipboard)
      ifconfig | tr "\n" "β†’" | tr "\r" "β†’" | grep -Eo "β†’en0.*?β†’en[[:digit:]]" | grep -Eo "inet[[:blank:]+]([0-9]{1,3}\.){3}[0-9]{1,3}" | cut -d' ' -f2 | tr -d "\n" | pbcopy && pbpaste
    • Or get the LAN IP address via command line (right into your clipboard)
      ifconfig | tr "\n" "→" | tr "\r" "→" | grep -Eo "→en[[:digit:]].*?active→" | grep -v "en0" | grep -Eo "inet[[:blank:]+]([0-9]{1,3}\.){3}[0-9]{1,3}" | cut -d' ' -f2 | tr -d "\n" | pbcopy && pbpaste

Android

  • Launch Charles and keep it running

  • Get the IP address

  • Make sure the Android device uses the same network as Charles

  • On Android device

    • Go to Settings -> Wi-Fi -> long click the network in use -> Modify network -> Advanced options -> Proxy -> Manual

      • Proxy hostname = IP address
      • Proxy port = 8888
    • Launch Browser, visit https://chls.pro/ssl, save the certificate

    • The system would ask you to set a lock screen PIN or password, just set one and save it
    • Now the certificate is installed
    • Open an application and monitor the traffic on Charles
  • A dialog pops up on computer asking "A connection attempt to Charles has been made from the host ...", just click Allow button

Android N (7.0, API level 24) and afterwards

  • Open your Android project with Android Studio
  • Android Studio -> File -> New -> Android resource directory
    • Directory name = xml
    • Directory type = xml
    • Source set = debug
  • Android Studio -> File -> New -> XML resource file
    • File name = network_security_config
    • Root element = network-security-config
  • Above step would generate a XML file with the given root element. Now paste below content to replace the existing content in the generated XML file.
    <?xml version="1.0" encoding="utf-8"?>
    <network-security-config xmlns:android="http://schemas.android.com/apk/res/android">
        <debug-overrides>
            <trust-anchors>
                <!-- Trust user added CAs while debuggable only -->
                <certificates src="user" />
            </trust-anchors>
        </debug-overrides>
    </network-security-config>
  • Then go to debug source set, create a blank AndroidManifest.xml file if you don't have one for the debug build variant, and add content like below (eventually the manifest merger will merge it with the main manifest). When you already have one, simply add the networkSecurityConfig attribute under application.
    <?xml version="1.0" encoding="utf-8"?>
    
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools">
    
        <application
            android:networkSecurityConfig="@xml/network_security_config">
        </application>
    
    </manifest>

Now the SSL proxying should work for your app's debug build variant, but not for release build variant.

iOS

  • Launch Charles and keep it running

  • Get the IP address

  • Make sure the iOS device uses the same network as Charles

  • On iOS device

    • Open an application and monitor the traffic on Charles
  • A dialog pops up on computer asking "A connection attempt to Charles has been made from the host ...", just click Allow button

iOS 10.3 and afterwards

  • After the certificate is installed
  • Go to Settings -> General -> About -> Certificate Trust Settings -> Enable Full Trust For Root Certificates -> enable Charles' certificate

Terminal

In case you need to debug via curl in a terminal:

  • To set Charles as the proxy

    export http_proxy=http://127.0.0.1:8888 && export https_proxy=$http_proxy
  • To remove the proxy

    unset http_proxy https_proxy

SSL CA Certificate

  • Charles Proxy running on the same computer provides the same SSL certificate.

More Repositories

1

AndroidSDK

🐳 Full-fledged Android SDK Docker Image
Dockerfile
1,252
star
2

AwesomeValidation

Android validation library which helps developer boil down the tedious work to three easy steps.
Java
1,152
star
3

ScreenshotsNanny

Android library helps take screenshots for publishing on Google Play Store.
Java
234
star
4

awesome-asus-tinker-board

A curated list of ASUS Tinker Board resources
63
star
5

AirPdfPrinter

Virtual PDF AirPrint printer
Dockerfile
57
star
6

Captain-ADB

Providing simple web API and view for Android Debug Bridge (adb). Free your imagination, use it as the way you want.
Ruby
51
star
7

namedict

Generate Chinese names for the newborn baby which are also applicable for multilingual pronunciation (English, and maybe Deutsch).
Ruby
41
star
8

SonarOnDocker

🐳 πŸ“‘ Docker way of running SonarQube + any DB
Java
25
star
9

AgileNotifier

Agile Notifier - an easy way of monitoring Agile SW Engineering, including CI (Continuous Integration), SCM (Source Control Management), and ITS (Issue Tracking System).
Ruby
16
star
10

jooi

Convert the results of Infer (static analyzer by Facebook) to JUnit format results.
Ruby
15
star
11

MacManual

Installation and Setup Guide
14
star
12

PermissionMatters

Check your Android application's permission changes
Go
14
star
13

MobileDevicePool

Web UI to manage your mobile devices kingdom.
Ruby
14
star
14

NoNewPermissionForAndroid

Ruby
10
star
15

TechNewsletter

The engineering way of composing a responsive design newsletter email in markup language
Ruby
8
star
16

dotfiles

Shell
4
star
17

Lifecycle

A curated list of lifecycle explanation in illustration
4
star
18

reMarkable

My reMarkable resources
Shell
4
star
19

AppReputation

Ruby gem for retrieving application's ratings and reviews
Ruby
4
star
20

N0L1mIT

No Limit - η„‘η–†
Shell
4
star
21

JunitReportGenerator

Easy and flexible solution to generating JUnit test result report from any format of data.
Ruby
3
star
22

cryonics

A Chrome extension which helps user save all opened tabs and resuscitate them all at once later.
JavaScript
3
star
23

ACES

ACES - A Chrome Extension Scaffold
HTML
2
star
24

GeekGadgets

2
star
25

CozmoSDK

Anki’s CozmoSDK
Nix
2
star
26

Kotlinker

Kotlin Docker Image
2
star
27

Smarping

Smart shopping list benefits from machine learning (not yet)
Java
2
star
28

Doraemon

A bot
JavaScript
2
star
29

AndroidSDKPackagesDownloader

Download missing Android SDK packages automatically via Gradle (from dummy project dependencies)
Java
2
star
30

RegionChanger

Change region (language, IP address) on the go - debug companion
Java
2
star
31

CurriculumVitae

RΓ©sumΓ© template in LaTeX
TeX
2
star
32

GoJourney

My journey of learning Go
1
star
33

thyrlian.github.io

Website for Basgeekball
CSS
1
star
34

PupilProgramming

Teach πŸ‘¦ how to πŸ‘¨β€πŸ’»
Ruby
1
star
35

MCGW

Most Common German Words - a web crawler extracts vocabularies from canonical German news websites
Ruby
1
star
36

EngineeringExcellence

Engineering Excellence Methodology
1
star
37

BuildCompanion

Your companion for build - monitor, notify, analyze
1
star
38

ComicCollection

Load your comic collection to a server
1
star
39

JIRA-Steward

Kotlin
1
star
40

gradleman

A man who helps you with gradle stuff.
Ruby
1
star
41

VideoHub

Play your videos everywhere (on mobile, Chromecast or whatever)
Ruby
1
star
42

LAB

My personal laboratory for trying out and learning about something new to me πŸ‘¨β€πŸ”¬πŸ”¬
Kotlin
1
star
43

OpenStackSwissKnife

A Docker image contains Swiss knife tool set for managing OpenStack
Shell
1
star
44

mind_the_changes

Mind the code changes since last release
Ruby
1
star
45

PersonalizedBulletinBoard

1
star