viewstate value error senting post data by curl android - android

iam a user of a aspx website ,i recently made a shell script to download a pdf file from the website,the script work very fine 2-3 days..however it stops working after that...the error was 'viewstate validation' error .iam a complete noob in shell programming..
Viewstate value i captured by using curl command:
/wEPDwUJOTcyNDMyNDExZGTFH+8YURsFdHWIPx+4glo2ovFz2w==
Viewstate value i posted using curl command :
/wEPDwUJOTcyNDMyNDExZGTFH+8YURsFdHWIPx+4glo2ovFz2w==
Viewstate value error shown by the aspx webpage:
/wEPDwUJOTcyNDMyNDExZGTFH 8YURsFdHWIPx 4glo2ovFz2w==
As you can see the viewstate value shown by the error page doesnt contain '+' symbol,is this could be the reason for the viewstate validation error?
But i post the data correctly by using curl command..bt i dont know why the error page shows an incorrect viewstate value.any help could be much appreciated
Can the webserver blocked the curl request? Because i used the curl command too often
So i changed the user agent and ip address still showing viewstate error webpage

Instead of auto-generating the validation keys which is the default in ASP.Net specify them explicitly as shown below. These keys are used to validate view state.
Also, in your aspx page try adding these to Page directive at top of your page: ViewStateEncryptionMode="Never" EnableViewStateMac="false".
Generate your own keys explicitly since its a security feature by using IIS Manager as explained at this URL: Generate Keys in IIS
<system.web>
<machineKey
validationKey="21F090935F6E49C2C797F69BBAAD8402ABD2EE0B667A8B44EA7DD4374267A75D7
AD972A119482D15A4127461DB1DC347C1A63AE5F1CCFAACFF1B72A7F0A281B"
decryptionKey="ABAA84D7EC4BB56D75D217CECFFB9628809BDB8BF91CFCD64568A145BE59719F"
validation="SHA1"
decryption="AES"
/>
</system.web>

Related

Example GET request to manage topic subscriptions from the server side using Firebase Cloud Messaging

I found at https://developers.google.com/instance-id/reference/server#get_information_about_app_instances the following example GET request:
https://iid.googleapis.com/iid/info/nKctODamlM4:CKrh_PC8kIb7O...clJONHoA?details=trueAuthorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
The key in that example is: AIzaSyZ-1u...0GBYzPu7Udno5aA. Where can I find my key, the one that I should use in my GET request? I am trying to find it at https://console.developers.google.com/apis/credentials, and this is what I see:
I tried using all of the four keys that you see in the image above, and I always receive this message from the browser:
{"error":"MissingAuthorization"}
Does this error refer to the key being wrong, or to something else? Am I looking in the right place for the key? Thank you.
EDIT 1: I was looking at the question at How to check how many topics has been subscribed?, and I also tried using the keys that I found in my Firebase Console, under the "Cloud Messaing" tab. This is what I see:
I tried the GET request using those keys in the image above as well and I still see the same error: {"error":"MissingAuthorization"}.
EDIT 2: I am using this from the command line:
C:\curl>curl -k https://iid.googleapis.com/iid/info/nKctODamlM4:CKrh_PC8kIb7O...clJONHoA?details=trueAuthorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{"error":"MissingAuthorization"}
C:\curl>
Notice how I simply copied/pasted what I found at https://developers.google.com/instance-id/reference/server#get_information_about_app_instances under the "Example GET request" heading. I am not even attempting to use my own keys and I see the same error: {"error":"MissingAuthorization"}. Does it mean the problem is with the key I am using? Is not it the one I see in the Firebase Console?
Based on the instructions at https://developers.google.com/instance-id/reference/server, under the heading "Get information about app instances", it shows that it is necessary to provide the Authorization: key=YOUR_API_KEY, which is set in the header. See at https://android.jlelse.eu/firebase-push-notification-using-curl-command-devoid-backend-e63795d282c4 an example of how to provide a parameter in the header.
Concerning the Authorization: key=YOUR_API_KEY that has to be used, it is the key that appears in the "EDIT 1" section of this question. I used the Server key, not the Legacy server key, and it worked for me.
https://developers.google.com/instance-id/reference/server shows this end point: https://iid.googleapis.com/iid/info/IID_TOKEN. But IID_TOKEN must be replaced with the instance ID token which corresponds to the instance of the app that was installed on a device. In my case, I found it by printing the instance ID or token of the device, using the following code in the first activity of my Android app:
Log.d("The token of device: ", FirebaseInstanceId.getInstance().getToken());
In the log of the Android monitor, I found the IID_TOKEN that I needed:
D/The token of device:: f35EFw4bsef:QWE34bFm56ZuQLWYSDDgPlkf4a88Lu6Gp4DoXVDJ5dRIlsdDncq0UdNnlDi7wxbbut6YX7Z1kwgyS3bzk_Zrl-1doHCf9XFdOXTThNzo4sDFEWqQjHKfNa3uH2Js4Flbf_CnRkD2Mftr
Finally, I used cURL from the command prompt, and you can see how I obtained results correctly:
C:\curl>curl -X GET -k --header "Authorization: key=AAAAJ5XteYp:DKE32aIdFalyFXku6A-eR_wHL6ZBUFxfyPtcrm3wwF2l-nPEv_vAeYqo3NJzaIKKcSSow6gqoAwf3cBEm8QWYbF6w-asW0SX0RmHZftQglwmo_ziwrk8wFcGp1_DOQ1PLFFgP4BFWXAD" "https://iid.googleapis.com/iid/info/f35EFw4bsef:QWE34bFm56ZuQLWYSDDgPlkf4a88Lu6Gp4DoXVDJ5dRIlsdDncq0UdNnlDi7wxbbut6YX7Z1kwgyS3bzk_Zrl-1doHCf9XFdOXTThNzo4sDFEWqQjHKfNa3uH2Js4Flbf_CnRkD2Mftr
{"applicationVersion":"22","attestStatus":"NOT_ROOTED","application":"com.[myapp]","scope":"*","authorizedEntity":"232255245625","appSigner":"3d34g3fs3443292d825f21da4fdd5b34a56f2a3h","platform":"ANDROID"}
C:\curl>
Note: In the code above I have changed the values of things such as tokens and keys for privacy purposes, but you need to use your values and everything should work.

Tasker App: Why my HTTP POST is not sending parameters?

I'm making a simple HTTP POST request using Tasker app, it's working fine but somehow it's not sending my arguments. HTTP GET is working fine. What am I doing wrong?
The only thing the server does is JSON stringify all received parameters and return them like: Text: { parameters }
HTTP GET is working:
HTTP POST works, it returns the response "text: {}" but doesn't return any parameter:
Now sometimes it shows "Bad Request Error 400"
I've tested it with another server and this issue persists...
Here's a fiddle to send get and post requests to the same server and both work.
I've exported my task as xml for you to test: You can download it here
Thanks in advance guys!
I have done a little testing with what you have supplied. It appears that your post parameters are making it to the server but %HTTPR is not getting populated. The Tasker documentation says that this variable will be populated if the response is "text-based", but this does not seem to be the case. I may not know what Tasker considers to be "text-based", but I have tried "text/plain" and "text/html" with no luck.
The work-around that I have come up with is to put the response into a file using the "Output File" field of the post task. (Leave "Content Type" blank or this won't work.) You can then read the file into a variable and do what you need to.
This is either a defect in Tasker, incorrect documentation, or just a misunderstanding of what it takes to make it work. This work-around, however, will get you what you need.
Here is a link to a GitHub repository with the updated task export. You may need to change the output file name/location to work with your device.
Update:
Since I posted the above solution, I have run across a Tasker plugin called "RESTask for Tasker". Evidently, Tasker has enough issues with HTML requests that a separate plugin was needed. I have tested this plugin with POST and it does work, so this is another way to go. The plugin is available on the Google Play store.

"SSL: CERTIFICATE_VERIFY_FAILED" Error in Kivy Launcher

I'm building a short python script, logging into a website and grabbing some data on the page, using requests.
The script runs perfectly fine on my Mac, but when launched in Kivy Launcher, I get a certificate error, and the data is not grabbed
The code is as follows :
s = requests.session()
response = s.post('URL', data=form)
responsetext = response.text
On my Mac, responsetext is the data I need. On Android, I get the same message as here : "SSL: CERTIFICATE_VERIFY_FAILED" Error and the variable remains empty. I of course have tried the solutions proposed in the said post, but they are of course NOT working.
I can't use Kivy's UrlRequest because I need to stay logged into the website (and thus using Requests' sessions)
Thanks !

Using prestashop webservices in Android

I have a problem with PrestaShop web services. I'm creating an Android app for one service. I configured everything in panel properly, gave corresponding permissions (e.g. GET, POST, DELETE, PUT for "carts"). When I'm sending GET request I get a response. Everything works. Problems start when I try to use e.g. DELETE, PUT or POST.
I followed this tutorial:
http://blog.belvg.com/prestashop-web-services.html
I make my test requests via site https://www.hurl.it/
Trying to update something, for instance, cart number 1 I get it by:
http:// MYDOMAIN .pl/api/carts/1?schema=synopsis
Then I edit some fields and try to send it back by PUT method and XML as the parameter, but I get:
<H1>400 Bad Request</H1>
Your browser sent a request that this server could not understand.
Trying to add a new cart does not work also. I try it by getting blank XML:
http://MYDOMAIN.pl/api/carts?schema=blank
That gives me blank XML. When I will not fill this XML and I try to send it back by POST I get the message:
<message>
<![CDATA[Internal error. To see this error please display the PHP errors.]]>
</message>
What means possibly it can work. But when I will fill it with data, I get again 400... Any Idea what I can be doing wrong? Did I miss something?
P.S. I have access to an only panel (not server) and can do things only via panel and send requests.

android POST - Unexpected response code 403

I want to add user inputs to web server. I use PHP and MySQL to store data. The app POSTs data to http://url_address/getData.php .
On localhost while I POST to http://192.168.1.38/getData.php everything works OK and data being inserted to database.
I also used https://www.000webhost.com/ to test my code and the data is inserted to that server. I could see from phpmyadmin.
But when I change address to my web address http://mywebsite.com/getData.php I get an error
E/Volley: [208] BasicNetwork.performRequest: Unexpected response code 403 for http://... I use hosting from https://ifastnet.com/
I googled and found that I have to change my httpd.conf file as belov:
<Directory />
AllowOverride none
Require all granted
</Directory>
But I use shared hosting plan and I cannot change httpd.conf , insted I should use .htaccess file. But when I use .htaccess I get below error:
A 500 error has occured
500 errors are generally caused by one of the following two problems.
1) A bad entry in the site .htaccess file, if you are the webmaster
try logging into your cPanel, and use the file manager to rename your
.htaccess file if this fixes the error you should then check the
contents of the .htaccess file / roll back any recent changes.
2) A php error / code error also causes a 500 error, you can try
enabling 'PHP display_errors' by following this guide Enable Display
errors
If after trying both of the above solutions and you are still seeing
the 500 error please do contact support
help me to overcome this problem.

Categories

Resources