JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 08.05.2021, 16:29
G@ry G@ry is offline
Modem User
 
Join Date: May 2021
Posts: 2
Default Script search for sagemcom 4

Hello,
I cannot reconnect my sagem4 box
Could someone help me with a sagemcom 4 to do a reconnect script please?
Thank you
Reply With Quote
  #2  
Old 14.05.2021, 20:29
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

Quote:

[[[HSRC]]]


[[[STEP]]]
[[[REQUEST raw="true"]]]
GET / HTTP/1.1
Host: %%%routerip%%%
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
accept-language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
accept-encoding: gzip, deflate
connection: keep-alive
upgrade-insecure-requests: 1
dnt: 1
sec-gpc: 1
if-none-match: ecb0e615
[[[/REQUEST]]]
[[[/STEP]]]

[[[STEP]]]
[[[REQUEST raw="true"]]]
POST /ws HTTP/1.1
Host: %%%routerip%%%
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
accept: */*
authorization: X-Sah-Login
accept-language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
accept-encoding: gzip, deflate
content-type: application/x-sah-ws-4-call+json
Origin: **External links are only visible to Support Staff****External links are only visible to Support Staff**
Connection: keep-alive
Referer: **External links are only visible to Support Staff****External links are only visible to Support Staff**
connection: keep-alive
dnt: 1
sec-gpc: 1

{"service":"sah.Device.Information","method":"createContext","parameters":{"applicationName":"web ui" ,"username":"%%%user%%%","password":"%%%pass%%%"}}
[[[/REQUEST]]]
[[[RESPONSE keys="context"]]]
"contextID":"(.*?)"
[[[/RESPONSE]]]
[[[/STEP]]]

[[[STEP]]]
[[[REQUEST raw="true" postraw="true"]]]
POST /ws HTTP/1.1
Host: %%%routerip%%%
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
accept: */*
accept-language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
accept-encoding: gzip, deflate
content-type: application/x-sah-ws-4-call+json
Origin: **External links are only visible to Support Staff****External links are only visible to Support Staff**
Connection: keep-alive
Referer: **External links are only visible to Support Staff****External links are only visible to Support Staff**
authorization: X-Sah %%%context%%%
x-context: %%%context%%%
content-length: 72
connection: keep-alive
cookie: sah/contextId=%%%context%%%
dnt: 1
sec-gpc: 1

7b2273657276696365223a224e4d43222c226d6574686f64223a227265626f6f74222c22706172616d6574657273223a7b22 726561736f6e223a224755495f5265626f6f74227d7d
[[[/REQUEST]]]
[[[/STEP]]]


[[[/HSRC]]]
here you go, created via teamviewer session
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 18.05.2021 at 12:47.
Reply With Quote
  #3  
Old 14.05.2021, 20:54
G@ry G@ry is offline
Modem User
 
Join Date: May 2021
Posts: 2
Default

A big thanks Jiaz you're the best))

Last edited by G@ry; 17.05.2021 at 20:47.
Reply With Quote
  #4  
Old 17.05.2021, 13:19
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

Thanks to you for your time/help with this. Teamviewer+Developer Tools of browser + Time to test several script attempts
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 17.05.2021, 20:27
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

This is the raw script, pastebin.com/hMQnic67
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 18.05.2021 at 12:47.
Reply With Quote
  #6  
Old 05.09.2021, 03:41
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 347
Default

Hello ! A recent update to firmware 4.15.10 has broken all reconnect scripts for this router. I tried recording it both in normal mode and RAW but it doesn't work.

Would you kindly take another looks please ?
Reply With Quote
  #7  
Old 06.09.2021, 02:32
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 347
Default

I think I might be onto something. I tried the following requests with HTTP request Maker on Firefox and got my router to reboot. However, translating these request into Reconnect Script doesn't seem to work. I must have done an error somewhere.

First I open my browser and go to my Livebox login page. Then I press SHIFT+ALT+Y to open the HTTP request Maker. The requests below only work if they're executed on the router's login page, it doesn't work on an empty tab, even when supplying the right address in the Target Site field.

REQUEST #1
Quote:
Target Site: **External links are only visible to Support Staff****External links are only visible to Support Staff** (My router's IP + /ws)

Method: POST

Request Headers:

authorization: X-Sah-Login
content-length: 158
connection: keep-alive

Body Data:

{"service":"sah.Device.Information","method":"createContext","parameters":{"applicationName":"so_sdk ut","username":"admin","password":"MY PASSWORD THAT MAKES THE ENTIRE BODY A TOTAL OF 158 CHARACTERS"}}
Response Data:
Quote:
{'status':0,'data':{'contextID':'A UNIQUE ID THAT CHANGES EVERYTIME THAT REQUEST IS SENT BUT IS REQUIRED FOR THE NEXT REQUESTS','username':'admin','groups':'http,admin'}}
REQUEST #2:
Quote:
Target Site: **External links are only visible to Support Staff****External links are only visible to Support Staff** (My router's IP + /ws)

Method: POST

Request Headers:

authorization: X-Sah THE CONTEXT ID I WAS GIVEN DURING REQUEST 1.
connection: keep-alive
x-context: THE CONTEXT ID I WAS GIVEN DURING REQUEST 1.
content-length: 466
content-type: application/x-sah-ws-4-call+json

Body Data:

{"service":"Probe","method":"logEvents","parameters":{"events":[{"EventSource":"gui_module","EventKey":"GUI","EventParameters":{"userSession":"THE CONTEXT ID I WAS GIVEN DURING REQUEST 1.","source":"GUI","page":"Redémarrage","state":"Défaut","action":"restart","browserName":"Firefox ","browserVersion":"91.0","browserEngine":"","deviceType":"","deviceVendor":"","deviceModel":"","osN ame":"Windows","osVersion":"10","screenSize":"1920x1080"}}]}}
Response Data:
Quote:
{'status':true}
REQUEST #3:
Quote:
Target Site: **External links are only visible to Support Staff****External links are only visible to Support Staff** (My router's IP + /ws)

Method: POST

Request Headers:

authorization: X-Sah THE CONTEXT ID I WAS GIVEN DURING REQUEST 1.
connection: keep-alive
x-context: THE CONTEXT ID I WAS GIVEN DURING REQUEST 1.
content-length: 72
content-type: application/x-sah-ws-4-call+json

Body Data:

{"service":"NMC","method":"reboot","parameters":{"reason":"GUI_Reboot"}}
Response Data:
Quote:
{'status':true}
Reply With Quote
  #8  
Old 06.09.2021, 18:13
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

If you want we can check together via Teamviewer and try to update the script to make it work
I already see difference to the script
old script found contextID at
Quote:
"contextID":"(.*?)"
but now it must be
Quote:
"userSession":"(.*?)"
old script, see pastebin.com/hMQnic67
__________________
JD-Dev & Server-Admin
Reply With Quote
  #9  
Old 06.09.2021, 18:42
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 347
Default

Quote:
Originally Posted by Jiaz View Post
If you want we can check together via Teamviewer and try to update the script to make it work
I already see difference to the script
old script found contextID at

but now it must be


old script, see pastebin.com/hMQnic67
I've tried a few more things. I think one of the issue is in my requests, the content-type is set to : "application/x-sah-ws-4-call+json"

But looking at the reconnect logs of JDownloader, the program replaces it by "application/json; charset=UTF-8"

I tried copying the requests JDownloader produced and sending them manually with HTTP request Maker on Firefox, and changing that one field back to "application/x-sah-ws-4-call+json" makes it work.

I can also go for a Teamviewer session if need be
Reply With Quote
  #10  
Old 07.09.2021, 15:11
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

@bugnotme: Wait for next core update, then JDownloader should send correct content-type header from reconnect script. Good catch!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #11  
Old 07.09.2021, 15:22
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 347
Default

Quote:
Originally Posted by Jiaz View Post
@bugnotme: Wait for next core update, then JDownloader should send correct content-type header from reconnect script. Good catch!
Thanks ! Do you have an ETA on that update per chance ?
Reply With Quote
  #12  
Old 07.09.2021, 16:22
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

@bugmenot: Update is live, please update and test and provide feedback
__________________
JD-Dev & Server-Admin
Reply With Quote
  #13  
Old 07.09.2021, 17:05
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 347
Default

Quote:
Originally Posted by Jiaz View Post
@bugmenot: Update is live, please update and test and provide feedback
I updated to today's build but JDownloader seems to still force the "application/json; charset=UTF-8" type.

I tried a script with the correct content-type and one without a content-type specified, but the logs still show the request is sent with the wrong "application/json; charset=UTF-8" content-type.

Could that be a remnant from the previous build ? Should I uninstall and download a new version again ?
Reply With Quote
  #14  
Old 07.09.2021, 17:14
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

No, no need to uninstall!
Can you please create a log? https://support.jdownloader.org/Know...d-session-logs click the test button and then create log and post logID. Please enable Settings->Advanced Settings->Log.debugmodeenabled before and restart JDownloader
Alternative we can do a teamviewer session? contact me via support@jdownloader.org
__________________
JD-Dev & Server-Admin
Reply With Quote
  #15  
Old 07.09.2021, 17:49
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 347
Default

07.09.21 16.47.35 <--> 07.09.21 16.48.50 jdlog://9357825302851/

Here's my log. I've also sent you an email with my Teamviewer credentials, if need be.
Reply With Quote
  #16  
Old 08.09.2021, 11:25
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

Maybe you can share your working script ?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #17  
Old 08.09.2021, 12:43
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 347
Default

Quote:
Originally Posted by Jiaz View Post
Maybe you can share your working script ?
Already did on JDownloader's database ^^

Here it is, still :

Quote:
[[[HSRC]]]
[[[STEP]]]
[[[REQUEST raw="true"]]]
POST /ws HTTP/1.1
Host: %%%routerip%%%
authorization: X-Sah-Login
content-length: 158
connection: keep-alive

{"service":"sah.Device.Information","method":"createContext","parameters":{"applicationName":"so_sdk ut","username":"%%%user%%%","password":"%%%pass%%%"}}

[[[/REQUEST]]]
[[[RESPONSE keys="context"]]]
"contextID":"(.*?)"
[[[/RESPONSE]]]
[[[/STEP]]]

[[[STEP]]]
[[[REQUEST raw="true"]]]
POST /ws HTTP/1.1
Host: %%%routerip%%%
authorization: X-Sah %%%context%%%
connection: keep-alive
x-context: %%%context%%%
content-length: 466
content-type: application/x-sah-ws-4-call+json

{"service":"Probe","method":"logEvents","parameters":{"events":[{"EventSource":"gui_module","EventKey":"GUI","EventParameters":{"userSession":"%%%context%%%","sourc e":"GUI","page":"Redémarrage","state":"Défaut","action":"restart","browserName":"Firefox","browserVe rsion":"91.0","browserEngine":"","deviceType":"","deviceVendor":"","deviceModel":"","osName":"Window s","osVersion":"10","screenSize":"1920x1080"}}]}}
[[[/REQUEST]]]
[[[/STEP]]]

[[[STEP]]]
[[[REQUEST raw="true"]]]
POST /ws HTTP/1.1
Host: %%%routerip%%%
authorization: X-Sah %%%context%%%
connection: keep-alive
x-context: %%%context%%%
content-length: 72
content-type: application/x-sah-ws-4-call+json

{"service":"NMC","method":"reboot","parameters":{"reason":"GUI_Reboot"}}
[[[/REQUEST]]]
[[[/STEP]]]
[[[/HSRC]]]
Reply With Quote
  #18  
Old 08.09.2021, 15:50
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

Thanks for sharing and helping out with this script
__________________
JD-Dev & Server-Admin
Reply With Quote
  #19  
Old 09.09.2021, 01:29
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 347
Default

Quote:
Originally Posted by Jiaz View Post
Thanks for sharing and helping out with this script
Thank YOU for your reactivity in patching the issue when it was discovered
Reply With Quote
  #20  
Old 09.09.2021, 16:24
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,936
Default

;)
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 20:55.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.