Proxy Wifi setting android

https://support.portswigger.net/customer/portal/articles/1841150-creating-an-ad-hoc-wireless-network-in-os-x

서버 구축

finger@fingerfly:/etc/squid3$ cat squid.conf
# 서버이름
http_port 3128 
#   (프락시 서버의 서비스 포트)
# cache_mem 8MB 
#    (캐시메모리설정)
# Maximum_object_size 4096 
# (캐시에 저장되는 파일 크기 제한-4메가 넘는 파일은 저장하지 않음)
# cache_dir /var/spool/squid 100 16 256
#캐시저장 디렉토리에 100메가까지 저장, 1차 디렉토리는 16개이고 2차 하위디렉토리는 256개
# access_log /var/log/squid3/access.log squid
# cache_log /var/log/squid3/cache.log
# cache_store_log /var/log/squid3/store.log
# 로그 저장 디렉토리 설정.. 자동으로 이렇게 됨. 나중에 찾아보기..
# cache_mgr root
# cache_effective_user
# cache_effective_user
#(캐시서버의 관리자 계정관 squid 서버를 작동시킬 유저와 그룹 지정 기본은 proxy:proxy
#acl all src all
acl all src all
# (기본적인 squid acl. 웹가속모드(전체허용)이면 따로  설정하지않아도 됨. 
http_access allow all
# 프록시 서버에 접근허용할 클라이언트 설정. 

# 윗줄에서 설정한 all 이라는 그룹을 허용한다는 뜻.


 @Override
    protected void onResume() {
        super.onResume();
        Log.i(TAG, "onResume");
       
        isUseWify();
    }
    
    @SuppressWarnings("deprecation")
public boolean checkProxy()
    {
    String proxyAddress = new String();
        try {
            if (Build.VERSION.SDK_INT < 11) {
                proxyAddress = android.net.Proxy.getHost(getApplicationContext());
            } else {
                proxyAddress = System.getProperty("http.proxyHost");
            }
            if (proxyAddress == null || proxyAddress.equals("")) {
                return false;
            }
        } catch (Exception ex) {
        return false;
        }
        return true;
    }

private void isUseWify() {
if (checkProxy()) {
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (null != wifi && wifi.isAvailable() && (wifi.getDetailedState() == DetailedState.CONNECTED)) {
// 비정상적인 접속(프록시)으로 인해 서비스를 종료합니다. 고객센터로 문의하여 주시기 바랍니다.
Dialog dialog = new Dialog(this);
dialog.setOnAlertClickListener(new AlertDialogListener() {

@Override
public void onClick(KJDialog dialog) {
// TODO Auto-generated method stub
finish();
}

});
dialog.showAlertDialog("비정상적인 접속(프록시)으로 인해 서비스를 종료합니다. 고객센터로 문의하여 주시기 바랍니다.");
}
}
}

댓글