Closed icyflame closed 6 years ago
ERP returns "Some system error occurred." on running main.go
main.go
Curl request doesn't seem to be the problem because subjects are returned when the following curl request is run with a valid JSESSIONID.
JSESSIONID
curl 'https://erp.iitkgp.ernet.in/Acad/timetable_track.jsp?action=second&dept=AE' \ -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Cookie: JSESSIONID=ABCD.worker3;' \ --data 'for_session=2018-2019&for_semester=AUTUMN&dept=AE'
Output on d66c0e7:
# siddharth @ siddharth-dell in /media/siddharth/code/personal-projects/chillzone on git:master x [20:24:51] $ pl # siddharth @ siddharth-dell in /media/siddharth/code/personal-projects/chillzone on git:master x [20:25:33] $ go build && ./chillzone | clipcopy # siddharth @ siddharth-dell in /media/siddharth/code/personal-projects/chillzone on git:master x [20:25:33] $ go build && ./chillzone 2018/07/23 20:25:47 Starting request for department AE 2018/07/23 20:25:47 Starting request for department AG 2018/07/23 20:25:48 Request completed. Returning response now. Response length: 4231 2018/07/23 20:25:48 Parsing HTML string now 2018/07/23 20:25:48 Found 0 subjects in department AE 2018/07/23 20:25:48 <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Welcome to ERP</title> <meta charset="windows-1252"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <script src="jquery/jquery-1.10.2.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <!-- START ENTRUST.NET SEAL CODE --> <script type="text/javascript"> (function(d, t) { var s = d.createElement(t), options = {'domain':'*.iitkgp.ac.in','style':'9','container':'entrust-net-seal'}; s.src = 'https://seal.entrust.net/sealv2.js'; s.async = true; var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr); s.onload = s.onreadystatechange = function() { var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return; try{goEntrust(options)} catch (e) {} }; })(document, 'script'); </script> </head> <body> <!-- Border Div --> <div class="container navbar-inverse" style="width: 100%; height: 5px"></div> <!-- Header Div --> <div class="container navbar-static-top" style="width: 100%; padding-left: 0px; padding-right: 0px"> <div class="row"> <div class="col-md-5"> <img height="100%" width="100%" src="./images/ERP-Banner.gif"/> </div> <div class="col-md-5"></div> <div class="col-md-2 hidden-sm hidden-xs" style="padding-top: 10px"> <table width="135" border="0" cellpadding="2" cellspacing="0" title="Click to Verify - This site chose Entrust SSL for secure e-commerce and confidential communications."> <tr> <td width="135" align="center" valign="top"> <div id="entrust-net-seal"><a href="https://www.entrust.com/ssl-certificates/"></a></div> <a target="_blank" style="color:#000000; text-decoration:none; font:bold 9px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;">About SSL Certificate</a> </td> <!--td width="135" align="center" valign="top"><script type="text/javascript" src="https://seal.websecurity.norton.com/getseal?host_name=erp.iitkgp.ernet.in&size=M&use_flash=NO&use_transparent=NO&lang=en"></script><br /> <a href="http://www.symantec.com/ssl-certificates" target="_blank" style="color:#000000; text-decoration:none; font:bold 7px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;">ABOUT SSL CERTIFICATES</a></td--> </tr> </table> </div> <!--div class="col-md-3 hidden-sm hidden-xs"><img class="img-rounded pull-right" height="100%" width="100%" src="html/images/s1.gif"/></div--> </div> </div> <!-- Border Div --> <div class="container navbar-inverse" style="width: 100%; height: 5px"></div> </body> </html> <html> <head> <title>ERP System, IIT Kharagpur</title> <meta charset="windows-1252"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"> <script src="../jquery/jquery-1.10.2.js"></script> <script src="../bootstrap/js/bootstrap.min.js"></script> </head> <body> <div id="includedContent"></div> <div class="container-fluid" style="padding-top: 5px"> <div class="panel panel-danger"> <div class="panel-heading"> <h3 class="panel-title"><strong>ERROR !!!</strong></h3> </div> <div class="panel-body"> <p class="text-justify text-danger"><strong>Some system error occurred.</strong></p> </div> </div> </div> </body> </html> 2018/07/23 20:25:48 0 SUBJECTS FOUND
Figured it out. My bad: I had JESSIONID in .env instead of JSESSIONID. Adding more debugging capabilities to this.
JESSIONID
.env
ERP returns "Some system error occurred." on running
main.go
Curl request doesn't seem to be the problem because subjects are returned when the following curl request is run with a valid
JSESSIONID
.Output on d66c0e7: