Advertisement
TomParts

ESP8266 lässt FritzBox klingeln.

Feb 9th, 2019
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 27.79 KB | None | 0 0
  1. In der FritzBox ist zu sehen, das sich angemeldet wurde.
  2. 09.02.19
  3. 20:43:20
  4. Anmeldung einer App des Benutzers admin von IP-Adresse 192.168.178.230. [2 Meldungen seit 09.02.19 20:22:23]
  5.  
  6. Hier der Code:
  7.  
  8. #include <Arduino.h>
  9. #include <ESP8266WiFi.h>
  10. #include <ESP8266WiFiMulti.h>
  11. #include <ESP8266HTTPClient.h>
  12. #include <tr064.h>
  13.  
  14. const char* WIFI_SSID = "TKIN";   // <-- ändern
  15. const char* WIFI_PASSWORD = "GaaaanzGeheim"; // <-- ändern
  16.  
  17. const char* USER = "admin";
  18. const char* PASSWORD = "GaaaanzGeheim"; // <-- ändern
  19. const char* FRITZBOX_IP = "192.168.178.1";
  20. const int FRITZBOX_PORT = 49000;
  21.  
  22. TR064 tr064_connection(FRITZBOX_PORT, FRITZBOX_IP, USER, PASSWORD);
  23.  
  24. const IPAddress STATIC_IP(192, 168, 178, 230);
  25. const IPAddress GATEWAY(192, 168, 178, 1);
  26. const IPAddress SUBNET(255, 255, 255, 0);
  27. const IPAddress DNS(GATEWAY);
  28. const char DEVICE_NAME[] = "ESPKlingel";
  29. ESP8266WiFiMulti WiFiMulti;
  30.  
  31. void setup() {
  32.     delay(5000);
  33.     WiFiMulti.addAP(WIFI_SSID, WIFI_PASSWORD);
  34.     Serial.begin(115200);
  35.     delay(10);
  36.     Serial.print("Connect Wifi ");
  37.  
  38.     while ((WiFiMulti.run() != WL_CONNECTED)) {
  39.         delay(50);
  40.         Serial.print(".");
  41.     }
  42.     Serial.println(WiFi.localIP());
  43.     Serial.println("Vor tr064_connection.init() ****************************************************************************");
  44.     tr064_connection.init();
  45.     Serial.println("Nach tr064_connection.init() ****************************************************************************");
  46.     delay(4000);
  47.     Serial.println("Jetzt klingelts ****************************************************************************");
  48.  
  49.     // Die Telefonnummer **9 ist der Fritzbox-Rundruf.
  50.     String call_params[][2] = { { "NewX_AVM-DE_PhoneNumber", "**9" } };
  51.     String req[][2] = { { } };
  52.     tr064_connection.action("urn:dslforum-org:service:X_VoIP:1",
  53.             "X_AVM-DE_DialNumber", call_params, 1, req, 0);
  54.  
  55.     Serial.println("Ende Jetzt klingelts ****************************************************************************");
  56.  
  57.     // Warte vier Sekunden bis zum auflegen
  58.     delay(4000);
  59.     Serial.println("Auflegen ****************************************************************************");
  60.  
  61.     tr064_connection.action("urn:dslforum-org:service:X_VoIP:1",
  62.             "X_AVM-DE_DialHangup");
  63.     Serial.println("Ende Auflegen ****************************************************************************");
  64.     //ESP.deepSleep(0);
  65. }
  66. void loop() {
  67. }
  68.  
  69. ***********************************************************************************************************************
  70. Hier kommt das Logging:
  71.  
  72. Connect Wifi [WIFI] delete old wifi config...
  73. [WIFI] start scan
  74. ...........................................[WIFI] scan done
  75. [WIFI] 4 networks found
  76.  --->  0: [7][34:31:C4:FD:10:49] TKIN (-53) *
  77.        1: [7][62:01:94:74:51:FF] ESP_7451FF (-59)  
  78.  --->  2: [7][7C:FF:4D:99:52:E0] TKIN (-57) *
  79.        3: [11][7E:FF:4D:81:4C:82] Breuer Gast (-83) *
  80.  
  81. [WIFI] Connecting BSSID: 34:31:C4:FD:10:49 SSID: TKIN Channal: 7 (-53)
  82. wifi evt: 1
  83. STA disconnect: 2
  84. wifi evt: 0
  85. wifi evt: 3
  86. [WIFI] Connecting done.
  87. [WIFI] SSID: TKIN
  88. [WIFI] IP: 192.168.178.230
  89. [WIFI] MAC: 34:31:C4:FD:10:49
  90. [WIFI] Channel: 7
  91. 192.168.178.230
  92.  
  93. Vor tr064_connection.init() ****************************************************************************
  94.  
  95. [HTTP] begin: 192.168.178.1:49000/tr64desc.xml
  96. [HTTP-Client][begin] host: 192.168.178.1 port: 49000 uri: /tr64desc.xml
  97. [hostByName] Host: 192.168.178.1 is a IP!
  98. [HTTP-Client] connected to 192.168.178.1:49000
  99. [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
  100. [HTTP-Client][handleHeaderResponse] RX: 'Cache-Control: max-age=120'
  101. [HTTP-Client][handleHeaderResponse] RX: 'Connection: close'
  102. [HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 13001'
  103. [HTTP-Client][handleHeaderResponse] RX: 'Content-Type: text/xml'
  104. [HTTP-Client][handleHeaderResponse] RX: 'Date: Sat, 09 Feb 2019 19:43:14 GMT'
  105. [HTTP-Client][handleHeaderResponse] RX: 'ETag: "1D03715CE63917F6B"'
  106. [HTTP-Client][handleHeaderResponse] RX: 'Expires: Sat, 09 Feb 2019 19:45:14 GMT'
  107. [HTTP-Client][handleHeaderResponse] RX: 'Last-Modified: Thu, 01 Jan 1970 00:01:15 GMT'
  108. [HTTP-Client][handleHeaderResponse] RX: 'Mime-Version: 1.0'
  109. [HTTP-Client][handleHeaderResponse] RX: ''
  110. [HTTP-Client][handleHeaderResponse] code: 200
  111. [HTTP-Client][handleHeaderResponse] size: 13001
  112. [HTTP] GET...
  113. [HTTP] POST... code: 200
  114. [HTTP-Client][writeToStreamDataBlock] connection closed or file end (written: 13001).
  115. [HTTP-Client][end] tcp is closed
  116.  
  117. <?xml version="1.0"?>
  118. <root xmlns="urn:dslforum-org:device-1-0"//fritz.box</presentationURL>
  119. </device>
  120. </root>
  121.  
  122.  
  123. [HTTP-Client][end] tcp is closed
  124. Service no 1:   urn:dslforum-org:service:DeviceInfo:1 @ /upnp/control/deviceinfo
  125. Service no 2:   urn:dslforum-org:service:DeviceConfig:1 @ /upnp/control/deviceconfig
  126. Service no 3:   urn:dslforum-org:service:Layer3Forwarding:1 @ /upnp/control/layer3forwarding
  127. Service no 4:   urn:dslforum-org:service:LANConfigSecurity:1 @ /upnp/control/lanconfigsecurity
  128. Service no 5:   urn:dslforum-org:service:ManagementServer:1 @ /upnp/control/mgmsrv
  129. Service no 6:   urn:dslforum-org:service:Time:1 @ /upnp/control/time
  130. Service no 7:   urn:dslforum-org:service:UserInterface:1 @ /upnp/control/userif
  131. Service no 8:   urn:dslforum-org:service:X_AVM-DE_Storage:1 @ /upnp/control/x_storage
  132. Service no 9:   urn:dslforum-org:service:X_AVM-DE_WebDAVClient:1 @ /upnp/control/x_webdav
  133. Service no 10:  urn:dslforum-org:service:X_AVM-DE_UPnP:1 @ /upnp/control/x_upnp
  134. Service no 11:  urn:dslforum-org:service:X_AVM-DE_Speedtest:1 @ /upnp/control/x_speedtest
  135. Service no 12:  urn:dslforum-org:service:X_AVM-DE_RemoteAccess:1 @ /upnp/control/x_remote
  136. Service no 13:  urn:dslforum-org:service:X_AVM-DE_MyFritz:1 @ /upnp/control/x_myfritz
  137. Service no 14:  urn:dslforum-org:service:X_VoIP:1 @ /upnp/control/x_voip
  138. Service no 15:  urn:dslforum-org:service:X_AVM-DE_OnTel:1 @ /upnp/control/x_contact
  139. Service no 16:  urn:dslforum-org:service:X_AVM-DE_Dect:1 @ /upnp/control/x_dect
  140. Service no 17:  urn:dslforum-org:service:X_AVM-DE_TAM:1 @ /upnp/control/x_tam
  141. Service no 18:  urn:dslforum-org:service:X_AVM-DE_AppSetup:1 @ /upnp/control/x_appsetup
  142. Service no 19:  urn:dslforum-org:service:X_AVM-DE_Homeauto:1 @ /upnp/control/x_homeauto
  143. Service no 20:  urn:dslforum-org:service:X_AVM-DE_Homeplug:1 @ /upnp/control/x_homeplug
  144. Service no 21:  urn:dslforum-org:service:X_AVM-DE_Filelinks:1 @ /upnp/control/x_filelinks
  145. Service no 22:  urn:dslforum-org:service:X_AVM-DE_Auth:1 @ /upnp/control/x_auth
  146. Service no 23:  urn:dslforum-org:service:WLANConfiguration:1 @ /upnp/control/wlanconfig1
  147. Service no 24:  urn:dslforum-org:service:WLANConfiguration:2 @ /upnp/control/wlanconfig2
  148. Service no 25:  urn:dslforum-org:service:WLANConfiguration:3 @ /upnp/control/wlanconfig3
  149. Service no 26:  urn:dslforum-org:service:Hosts:1 @ /upnp/control/hosts
  150. Service no 27:  urn:dslforum-org:service:LANEthernetInterfaceConfig:1 @ /upnp/control/lanethernetifcfg
  151. Service no 28:  urn:dslforum-org:service:LANHostConfigManagement:1 @ /upnp/control/lanhostconfigmgm
  152. Service no 29:  urn:dslforum-org:service:WANCommonInterfaceConfig:1 @ /upnp/control/wancommonifconfig1
  153. Service no 30:  urn:dslforum-org:service:WANDSLInterfaceConfig:1 @ /upnp/control/wandslifconfig1
  154.  
  155. Service no 31:  urn:dslforum-org:service:WANDSLLinkConfig:1 @ /upnp/control/wandsllinkconfig1
  156. Service no 32:  urn:dslforum-org:service:WANEthernetLinkConfig:1 @ /upnp/control/wanethlinkconfig1
  157. Service no 33:  urn:dslforum-org:service:WANPPPConnection:1 @ /upnp/control/wanpppconn1
  158. Service no 34:  urn:dslforum-org:service:WANIPConnection:1 @ /upnp/control/wanipconnection1
  159. Geting the initial nonce and realm
  160. action_1
  161. [HTTP] begin: 192.168.178.1:49000/upnp/control/wlanconfig1
  162. [HTTP-Client][begin] host: 192.168.178.1 port: 49000 uri: /upnp/control/wlanconfig1
  163.  
  164. <?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Header><h:InitChallenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1"><UserID>admin</UserID></h:InitChallenge ></s:Header><s:Body><u:GetGenericAssociatedDeviceInfo xmlns:u='urn:dslforum-org:service:WLANConfiguration:1'><NewAssociatedDeviceIndex>1</NewAssociatedDeviceIndex></u:GetGenericAssociatedDeviceInfo></s:Body></s:Envelope>
  165.  
  166. [hostByName] Host: 192.168.178.1 is a IP!
  167. [HTTP-Client] connected to 192.168.178.1:49000
  168. [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
  169. [HTTP-Client][handleHeaderResponse] RX: 'DATE: Sat, 09 Feb 2019 19:43:16 GMT'
  170. [HTTP-Client][handleHeaderResponse] RX: 'SERVER: FRITZ!Box 7490 UPnP/1.0 AVM FRITZ!Box 7490 113.07.01'
  171. [HTTP-Client][handleHeaderResponse] RX: 'CONNECTION: close'
  172. [HTTP-Client][handleHeaderResponse] RX: 'CONTENT-LENGTH: 653'
  173. [HTTP-Client][handleHeaderResponse] RX: 'CONTENT-TYPE: text/xml; charset="utf-8"'
  174. [HTTP-Client][handleHeaderResponse] RX: 'EXT:'
  175. [HTTP-Client][handleHeaderResponse] RX: ''
  176. [HTTP-Client][handleHeaderResponse] code: 200
  177. [HTTP-Client][handleHeaderResponse] size: 653
  178. [HTTP] POST... SOAPACTION: urn:dslforum-org:service:WLANConfiguration:1#GetGenericAssociatedDeviceInfo
  179. [HTTP] POST... code: 200
  180. [HTTP-Client][writeToStreamDataBlock] connection closed or file end (written: 653).
  181. [HTTP-Client][end] tcp is closed
  182.  
  183. <?xml version="1.0"?>
  184. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  185. <s:Header>
  186. <h:Challenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
  187. <Status>Unauthenticated</Status>
  188. <Nonce>C8F1BBEBED622CCB</Nonce>
  189. <Realm>F!Box SOAP-Auth</Realm>
  190. </h:Challenge>
  191. </s:Header>
  192. <s:Body>
  193. <s:Fault>
  194. <faultcode>s:Client</faultcode>
  195. <faultstring>UPnPError</faultstring>
  196. <detail>
  197. <UPnPError xmlns="urn:dslforum-org:control-1-0">
  198. <errorCode>503</errorCode>
  199. <errorDescription>Auth. failed</errorDescription>
  200. </UPnPError>
  201. </detail>
  202. </s:Fault>
  203. </s:Body>
  204. </s:Envelope>
  205.  
  206. [HTTP-Client][end] tcp is closed
  207. Got the initial nonce: C8F1BBEBED622CCB and the realm: F!Box SOAP-Auth
  208. Your secret is is: admin:F!Box SOAP-Auth:GeheimesPW
  209. Your secret is hashed: 06c0d81e03ce3032c6513d593e8ba8aa
  210.  
  211. Nach tr064_connection.init() ****************************************************************************
  212.  
  213. Jetzt klingelts ****************************************************************************
  214.  
  215. action_3
  216. action_1
  217. The auth token is 98470914b7be4fd5d83443e43581fc8a
  218. [HTTP] begin: 192.168.178.1:49000/upnp/control/x_voip
  219. [HTTP-Client][begin] host: 192.168.178.1 port: 49000 uri: /upnp/control/x_voip
  220.  
  221. <?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Header><h:ClientAuth xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1"><Nonce>C8F1BBEBED622CCB</Nonce><Auth>98470914b7be4fd5d83443e43581fc8a</Auth><UserID>admin</UserID><Realm>F!Box SOAP-Auth</Realm></h:ClientAuth></s:Header><s:Body><u:X_AVM-DE_DialNumber xmlns:u='urn:dslforum-org:service:X_VoIP:1'><NewX_AVM-DE_PhoneNumber>**9</NewX_AVM-DE_PhoneNumber></u:X_AVM-DE_DialNumber></s:Body></s:Envelope>
  222.  
  223. [hostByName] Host: 192.168.178.1 is a IP!
  224. [HTTP-Client] connected to 192.168.178.1:49000
  225. [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
  226. [HTTP-Client][handleHeaderResponse] RX: 'DATE: Sat, 09 Feb 2019 19:43:20 GMT'
  227. [HTTP-Client][handleHeaderResponse] RX: 'SERVER: FRITZ!Box 7490 UPnP/1.0 AVM FRITZ!Box 7490 113.07.01'
  228. [HTTP-Client][handleHeaderResponse] RX: 'CONNECTION: close'
  229. [HTTP-Client][handleHeaderResponse] RX: 'CONTENT-LENGTH: 519'
  230. [HTTP-Client][handleHeaderResponse] RX: 'CONTENT-TYPE: text/xml; charset="utf-8"'
  231. [HTTP-Client][handleHeaderResponse] RX: 'EXT:'
  232. [HTTP-Client][handleHeaderResponse] RX: ''
  233. [HTTP-Client][handleHeaderResponse] code: 200
  234. [HTTP-Client][handleHeaderResponse] size: 519
  235. [HTTP] POST... SOAPACTION: urn:dslforum-org:service:X_VoIP:1#X_AVM-DE_DialNumber
  236. [HTTP] POST... code: 200
  237. [HTTP-Client][writeToStreamDataBlock] connection closed or file end (written: 519).
  238. [HTTP-Client][end] tcp is closed
  239.  
  240. <?xml version="1.0"?>
  241. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  242. <s:Header>
  243. <h:NextChallenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
  244. <Status>Authenticated</Status>
  245. <Nonce>D87712443D169385</Nonce>
  246. <Realm>F!Box SOAP-Auth</Realm>
  247. </h:NextChallenge>
  248. </s:Header>
  249. <s:Body>
  250. <u:X_AVM-DE_DialNumberResponse xmlns:u="urn:dslforum-org:service:X_VoIP:1"></u:X_AVM-DE_DialNumberResponse>
  251. </s:Body>
  252. </s:Envelope>
  253.  
  254. [HTTP-Client][end] tcp is closed
  255.  
  256. Ende Jetzt klingelts ****************************************************************************
  257.  
  258. Auflegen ****************************************************************************
  259.  
  260. action_2
  261. action_1
  262. The auth token is 18d67f6f471c9b9c7d1fde701350b3ff
  263. [HTTP] begin: 192.168.178.1:49000/upnp/control/x_voip
  264. [HTTP-Client][begin] host: 192.168.178.1 port: 49000 uri: /upnp/control/x_voip
  265.  
  266. <?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Header><h:ClientAuth xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1"><Nonce>D87712443D169385</Nonce><Auth>18d67f6f471c9b9c7d1fde701350b3ff</Auth><UserID>admin</UserID><Realm>F!Box SOAP-Auth</Realm></h:ClientAuth></s:Header><s:Body><u:X_AVM-DE_DialHangup xmlns:u='urn:dslforum-org:service:X_VoIP:1'></u:X_AVM-DE_DialHangup></s:Body></s:Envelope>
  267.  
  268. [hostByName] Host: 192.168.178.1 is a IP!
  269. [HTTP-Client] connected to 192.168.178.1:49000
  270. [HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
  271. [HTTP-Client][handleHeaderResponse] RX: 'DATE: Sat, 09 Feb 2019 19:43:25 GMT'
  272. [HTTP-Client][handleHeaderResponse] RX: 'SERVER: FRITZ!Box 7490 UPnP/1.0 AVM FRITZ!Box 7490 113.07.01'
  273. [HTTP-Client][handleHeaderResponse] RX: 'CONNECTION: close'
  274. [HTTP-Client][handleHeaderResponse] RX: 'CONTENT-LENGTH: 519'
  275. [HTTP-Client][handleHeaderResponse] RX: 'CONTENT-TYPE: text/xml; charset="utf-8"'
  276. [HTTP-Client][handleHeaderResponse] RX: 'EXT:'
  277. [HTTP-Client][handleHeaderResponse] RX: ''
  278. [HTTP-Client][handleHeaderResponse] code: 200
  279. [HTTP-Client][handleHeaderResponse] size: 519
  280. [HTTP] POST... SOAPACTION: urn:dslforum-org:service:X_VoIP:1#X_AVM-DE_DialHangup
  281. [HTTP] POST... code: 200
  282. [HTTP-Client][writeToStreamDataBlock] connection closed or file end (written: 519).
  283. [HTTP-Client][end] tcp is closed
  284.  
  285. <?xml version="1.0"?>
  286. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  287. <s:Header>
  288. <h:NextChallenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
  289. <Status>Authenticated</Status>
  290. <Nonce>1F43593E04AFD129</Nonce>
  291. <Realm>F!Box SOAP-Auth</Realm>
  292. </h:NextChallenge>
  293. </s:Header>
  294. <s:Body>
  295. <u:X_AVM-DE_DialHangupResponse xmlns:u="urn:dslforum-org:service:X_VoIP:1"></u:X_AVM-DE_DialHangupResponse>
  296. </s:Body>
  297. </s:Envelope>
  298.  
  299. [HTTP-Client][end] tcp is closed
  300.  
  301. Ende Auflegen ****************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement