PotatoChicken / sandrop

Automatically exported from code.google.com/p/sandrop
0 stars 0 forks source link

custom plugin error #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
hi. i want make custom plugin. but this error. help me.

Original issue reported on code.google.com by labess...@gmail.com on 31 Mar 2014 at 2:39

Attachments:

GoogleCodeExporter commented 9 years ago
-dex is command from android sdk

check local.properties file that it points to android sdk. (android update 
project --path .)

http://code.google.com/p/sandrop/source/browse/projects/SandroProxyPlugin/readme
.txt

Original comment by supp.san...@gmail.com on 31 Mar 2014 at 3:01

GoogleCodeExporter commented 9 years ago

Original comment by supp.san...@gmail.com on 31 Mar 2014 at 3:01

GoogleCodeExporter commented 9 years ago
I did what you say but same error.
sdk.dir=C:/adt-bundle-windows-x86_64-20140321/sdk

Before it was like in the screenshot.

Original comment by labess...@gmail.com on 31 Mar 2014 at 3:14

Attachments:

GoogleCodeExporter commented 9 years ago
Can you copy paste text? 
It can not find some file it seems but then picture is truncated

Original comment by supp.san...@gmail.com on 31 Mar 2014 at 3:17

GoogleCodeExporter commented 9 years ago
Unknown argument: -dex
Buildfile: 
C:\adt-bundle-windows-x86_64-20140321\projects\SandroProxyPlugin\build.xml

BUILD FAILED
C:\adt-bundle-windows-x86_64-20140321\projects\SandroProxyPlugin\build.xml:171: 
Cannot find 
C:\adt-bundle-windows-x86_64-20140321\projects\SandroProxyPlugin\sdk.dir=[change
 this to reflect path to android sdk]\tools\ant\build.xml imported from 
C:\adt-bundle-windows-x86_64-20140321\projects\SandroProxyPlugin\build.xml

Total time: 377 milliseconds

after add this: sdk.dir=C:/adt-bundle-windows-x86_64-20140321/sdk

Unknown argument: -dex
Buildfile: 
C:\adt-bundle-windows-x86_64-20140321\projects\SandroProxyPlugin\build.xml
help:
     [echo] Android Ant Build. Available targets:
     [echo]    help:      Displays this help.
     [echo]    clean:     Removes output files created by other targets.
     [echo]               This calls the same target on all dependent projects.
     [echo]               Use 'ant nodeps clean' to only clean the local project
     [echo]    debug:     Builds the application and signs it with a debug key.
     [echo]               The 'nodeps' target can be used to only build the
     [echo]               current project and ignore the libraries using:
     [echo]               'ant nodeps debug'
     [echo]    release:   Builds the application. The generated apk file must be
     [echo]               signed before it is published.
     [echo]               The 'nodeps' target can be used to only build the
     [echo]               current project and ignore the libraries using:
     [echo]               'ant nodeps release'
     [echo]    instrument:Builds an instrumented package and signs it with a
     [echo]               debug key.
     [echo]    test:      Runs the tests. Project must be a test project and
     [echo]               must have been built. Typical usage would be:
     [echo]                   ant [emma] debug install test
     [echo]    emma:      Transiently enables code coverage for subsequent
     [echo]               targets.
     [echo]    install:   Installs the newly build package. Must either be used
     [echo]               in conjunction with a build target (debug/release/
     [echo]               instrument) or with the proper suffix indicating
     [echo]               which package to install (see below).
     [echo]               If the application was previously installed, the
     [echo]               application is reinstalled if the signature matches.
     [echo]    installd:  Installs (only) the debug package.
     [echo]    installr:  Installs (only) the release package.
     [echo]    installi:  Installs (only) the instrumented package.
     [echo]    installt:  Installs (only) the test and tested packages (unless
     [echo]               nodeps is used as well.
     [echo]    uninstall: Uninstalls the application from a running emulator or
     [echo]               device. Also uninstall tested package if applicable
     [echo]               unless 'nodeps' is used as well.
BUILD SUCCESSFUL
Total time: 784 milliseconds

Original comment by labess...@gmail.com on 31 Mar 2014 at 3:23

GoogleCodeExporter commented 9 years ago
Let me recheck myself with latest sdk. Maybe they change something recently.
But I build it on linux so maybe problem is just windows build.

Original comment by supp.san...@gmail.com on 31 Mar 2014 at 3:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It works okey on linux with latest sdk. 
But how do you start build? You should start with 
ant debug 

You can change headers also with intercept scripting.
example:
http://code.google.com/p/sandrop/issues/detail?id=48#c6

Original comment by supp.san...@gmail.com on 31 Mar 2014 at 4:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

http://code.google.com/p/sandrop/wiki/ScriptIntercept

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 8:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It looks like this plugin but this just add to http requests. need http/https. 
i hope i could tell.

https://code.google.com/p/sandrop/downloads/detail?name=custom_plugin_dex_1.jar&
can=2&q=

Original comment by labess...@gmail.com on 1 Apr 2014 at 8:25

GoogleCodeExporter commented 9 years ago
Script can do the same.
Just change request script to:

////////////////////////
import org.sandrop.webscarab.model.Request;
import org.sandrop.webscarab.model.Response;
import org.sandrop.webscarab.model.Message;
import org.sandrop.webscarab.model.HttpUrl;

// should intercept request
result = false;

// should intercept response 
intercept_response = false;

if (request != null){
    result = false;
    intercept_response = false;
    request.deleteHeader("Host");
    request.addHeader("Host", "host-value");
}
/////////////////////

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 8:27

GoogleCodeExporter commented 9 years ago
If you can exactly state logic what must 
plugin put in Host header I can make plugin for you.

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 8:32

GoogleCodeExporter commented 9 years ago
I want to show you a app. watch video, please. This app replace all http/https 
(GET/CONNECT) requests.

this works but only with GET method.
////////////////////////
import org.sandrop.webscarab.model.Request;
import org.sandrop.webscarab.model.Response;
import org.sandrop.webscarab.model.Message;
import org.sandrop.webscarab.model.HttpUrl;

// should intercept request
result = false;

// should intercept response 
intercept_response = false;

if (request != null){
    result = false;
    intercept_response = false;
    request.deleteHeader("Host");
    request.addHeader("Host", "host-value");
}
/////////////////////

Video is normally 13.4 mb max attach 10 mb

Original comment by labess...@gmail.com on 1 Apr 2014 at 9:12

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I see where is the problem. First CONNECT to upper proxy.

Maybe really do not work on first CONNECT request that goes to upper proxy.
This is because it intercepts client CONNECT request and responds with 
SandroProxy ssl certificate. It then creates new CONNECT request to upper proxy.
Will look what can be done about that.

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 9:31

GoogleCodeExporter commented 9 years ago

https://drive.google.com/file/d/0BxEHDZT3toTmWDlLSmw1ek9qX2c/

This one should also have changed request on first CONNECT to upper proxy.
But only if Settings->Capture data = ON, and used android os proxy localhost 
8008

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 1:49

GoogleCodeExporter commented 9 years ago
i tried but not connect https. warning certificate error. not need ssl 
certificate for https connections. connect with direct proxy connection.

Original comment by labess...@gmail.com on 1 Apr 2014 at 2:53

GoogleCodeExporter commented 9 years ago
You must export SandroProxy CA to android cert store.
Log tab-Menu Action Export CA to store 

To work direct to upper proxy with changed CONNECT request: 
It can be done but it's bigger change of code that affects all other features.

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 3:10

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
i understand. nothing to be done. you think maybe a different simple project. 
like http request filter, replacer. thanks again for interest.

Original comment by labess...@gmail.com on 1 Apr 2014 at 3:35

GoogleCodeExporter commented 9 years ago
I change that also support CONNECT request if capture data is OFF.
Link is the same. Please let me know if it works okey.

https://drive.google.com/file/d/0BxEHDZT3toTmWDlLSmw1ek9qX2c/

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 5:10

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
same, not work.

Original comment by labess...@gmail.com on 1 Apr 2014 at 6:00

GoogleCodeExporter commented 9 years ago
I tested with squid and looked with wireshark that some custom headers are 
append to CONNECT method. Tested also with twitter app that checks ssl 
certificates so I'm sure that direct connections are made.
Maybe you still have capture mode on.

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 6:06

GoogleCodeExporter commented 9 years ago
What kind of proxy are you connecting to? And why must be host header changed?

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 6:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
And what kind of error do you get? 
Can you test with some local proxy to see that host header is changed?

You can for example redirect to proxy that you use in video. 
There will be shown what kind of headers are coming in.

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 6:22

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Will look what is going on...

You must change also response script.
Probably there is result = true for some cases.
Then those http response results screens will not show.

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 7:56

GoogleCodeExporter commented 9 years ago
Probably this simple android server is making different CONNECT to upper proxy.
Can you increase log level so it shows more? On the bottom of settings.
Now it shows just that it receives HTTP 1.1 200 Connection established.
I wonder how CONNECT looks like...

Original comment by supp.san...@gmail.com on 1 Apr 2014 at 8:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
https://play.google.com/store/apps/details?id=com.icecoldapps.proxyserver&hl=en

Original comment by labess...@gmail.com on 2 Apr 2014 at 10:40

GoogleCodeExporter commented 9 years ago
Will look at it. Already have few ideas what to change. thnx!

Original comment by supp.san...@gmail.com on 2 Apr 2014 at 11:41

GoogleCodeExporter commented 9 years ago
I want to change url addresses in get and connect methods ALL http requests.

for example

normal http request
GET http://www.google.com.tr/ HTTP/1.1

CONNECT www.google.com:443 HTTP/1.1

what i want
GET http://@www.google.com.tr/ HTTP/1.1

CONNECT www.google.com:443? HTTP/1.1

can you make script separately get and connect methods?

and one last request. change http status codes.

example: coming HTTP/1.1 400 status. i want this HTTP/1.1 200 Connection 
established etc.

Original comment by labess...@gmail.com on 2 Apr 2014 at 1:56

GoogleCodeExporter commented 9 years ago
All that you can make in scripts I can then convert in plugin for you.
I last video I saw that you still have response script active. It triggers on 
json responses.
You can change that result = false, so it will not show gui.

/////////////////////

import org.sandrop.webscarab.model.Request;
import org.sandrop.webscarab.model.Response;
import org.sandrop.webscarab.model.Message;

// should intercept response
result = false;

if (response != null){
    String responseContentType = response.getHeader("Content-Type");
    if (responseContentType != null && responseContentType.contains("application/json")){
        result = true;
    }
}

/////////////////////

Now I will prepare new SandroProxy build so you can test if it works direct to 
your wap apn proxy.

Original comment by supp.san...@gmail.com on 2 Apr 2014 at 3:39

GoogleCodeExporter commented 9 years ago
after change result = false; does not appear. thanks. any more not need plugin. 
http works with direct to wap apn proxy. https works with extra proxy server 
apps. i would like to test new builds.

Original comment by labess...@gmail.com on 2 Apr 2014 at 4:10

GoogleCodeExporter commented 9 years ago
I'm looking what is different in extra proxy that works but I do not found any 
differences in CONNECT method :(
Can you try again https just with SandroProxy and show what are the errors in 
log tab?

Original comment by supp.san...@gmail.com on 2 Apr 2014 at 4:20

GoogleCodeExporter commented 9 years ago
I change a little bit. It always add headers keep-alive for Proxy-Connection 
and Connection. 
Link for apk is same as before.
Please try and make copy of what is in log tab to find out what is going on.
There should be also additional logs in adb logcat.

https://drive.google.com/file/d/0BxEHDZT3toTmWDlLSmw1ek9qX2c/

Original comment by supp.san...@gmail.com on 2 Apr 2014 at 5:40

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It looks that is okey connecting to proxy and sending CONNECT command.
Then is waiting for <200 Connection established> but no response happens.

The last build is working okey with prepaid operator proxy?
In log <this previous build logs with prepaid operator proxy.txt> looks okey.

Will try to add even more logging now that I know where freezes and slightly 
change logic.

Original comment by supp.san...@gmail.com on 3 Apr 2014 at 5:52

GoogleCodeExporter commented 9 years ago
"The last build is working okey with prepaid operator proxy?" yes builds works 
with prepaid operator proxy. but last build can not connect without credit.

Original comment by labess...@gmail.com on 3 Apr 2014 at 7:51

Attachments:

GoogleCodeExporter commented 9 years ago
New version with more logging and it's sending 
CONNECT HOST:PORT HTTP/1.1 
instead
CONNECT HOST:PORT HTTP/1.0
Please try how it works and send logs to analyze. 

https://drive.google.com/file/d/0BxEHDZT3toTmWDlLSmw1ek9qX2c/

Original comment by supp.san...@gmail.com on 3 Apr 2014 at 4:43

GoogleCodeExporter commented 9 years ago
https not working again. 

Original comment by labess...@gmail.com on 3 Apr 2014 at 5:11

Attachments:

GoogleCodeExporter commented 9 years ago
i want to change all urls with what i want value. could you help?
https://code.google.com/p/sandrop/issues/detail?id=106#c39

Original comment by labess...@gmail.com on 3 Apr 2014 at 6:26

GoogleCodeExporter commented 9 years ago
Here is some code how to change.
Creating new request instead the one that came in

http://code.google.com/p/sandrop/source/browse/projects/SandroProxyPlugin/src/or
g/sandroproxy/proxy/plugin/CustomPluginChangeRequest.java?name=1_5_90_additional
_plugin_example

Original comment by supp.san...@gmail.com on 3 Apr 2014 at 6:49