JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 08.05.2021, 15:29
G@ry G@ry is offline
Baby Loader
 
Join Date: May 2021
Posts: 9
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, 19:29
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
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 11:47.
Reply With Quote
  #3  
Old 14.05.2021, 19:54
G@ry G@ry is offline
Baby Loader
 
Join Date: May 2021
Posts: 9
Default

A big thanks Jiaz you're the best))

Last edited by G@ry; 17.05.2021 at 19:47.
Reply With Quote
  #4  
Old 17.05.2021, 12:19
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
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, 19:27
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

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

Last edited by Jiaz; 18.05.2021 at 11:47.
Reply With Quote
  #6  
Old 05.09.2021, 02:41
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
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, 01:32
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
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, 17:13
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
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, 17:42
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
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, 14:11
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
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, 14:22
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
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, 15:22
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

@bugmenot: Update is live, please update and test and provide feedback
__________________
JD-Dev & Server-Admin
Reply With Quote
  #13  
Old 07.09.2021, 16:05
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
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, 16:14
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
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, 16:49
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
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, 10:25
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

Maybe you can share your working script ?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #17  
Old 08.09.2021, 11:43
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
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, 14:50
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

Thanks for sharing and helping out with this script
__________________
JD-Dev & Server-Admin
Reply With Quote
  #19  
Old 09.09.2021, 00:29
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
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, 15:24
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

;)
__________________
JD-Dev & Server-Admin
Reply With Quote
  #21  
Old 30.09.2021, 03:25
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
Default

Hello again ! Facing a strange issue today :

I have recently installed Jdownloader on my Raspberry Pi 4 running Raspbian Buster 64-bits. I use the jar file to run JDownloader. The reconnect script for the Sagemcom 4 works fine on my Windows PC, but fails on my Raspberry. It used to work when I ran Raspbian Buster 32 bits on it. The router is still the same version it was when I made the script.

Other unrelated things that I did :
- added armhf architecture via dpkg
- installed box86 and box64

Any idea ?
Reply With Quote
  #22  
Old 30.09.2021, 03:47
bugnotme bugnotme is offline
BugMeNot Account
 
Join Date: Apr 2013
Posts: 385
Default

Log created with Debug Mode on my Raspberry Pi 4 running Raspbian Buster 64 Bits (failed reconnect)

30.09.21 03.39.05 <--> 30.09.21 03.40.57 jdlog://9258825302851/

Log created with Debug Mode on my Windows PC (successful reconnect)

30.09.21 03.41.47 <--> 30.09.21 03.45.18 jdlog://0358825302851/
Reply With Quote
  #23  
Old 04.10.2021, 17:49
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

@bugmenot: something's broken with the reconnect script/its password
it's broken in meaning of
Quote:
{password=�......�4,
How did you setup the reconnect? Copy/Paste into text editor? Copied a configuration file?
Looks like somehow the file/content got messed up
__________________
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 18:39.
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 - 2024, Jelsoft Enterprises Ltd.