diff --git a/bin/web/PS4transitionally.html b/bin/web/PS4transitionally.html
new file mode 100644
index 00000000..247f87b5
--- /dev/null
+++ b/bin/web/PS4transitionally.html
@@ -0,0 +1,76 @@
+
+
+
+ FFXIV 1.0 Login
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+
+
diff --git a/src/servers/Server_REST/SapphireAPI.cpp b/src/servers/Server_REST/SapphireAPI.cpp
index 764ef7b1..b1bc0e7f 100644
--- a/src/servers/Server_REST/SapphireAPI.cpp
+++ b/src/servers/Server_REST/SapphireAPI.cpp
@@ -70,6 +70,20 @@ bool Core::Network::SapphireAPI::login( const std::string& username, const std::
}
+
+bool Core::Network::SapphireAPI::insertSession( const uint32_t& accountId, std::string& sId )
+{
+ // create session for the new sessionid and store to sessionlist
+ auto pSession = boost::make_shared< Session >();
+ pSession->setAccountId( accountId );
+ pSession->setSessionId( (uint8_t *)sId.c_str() );
+
+ m_sessionMap[sId] = pSession;
+
+ return true;
+
+}
+
bool Core::Network::SapphireAPI::createAccount( const std::string& username, const std::string& pass, std::string& sId )
{
// get account from login name
diff --git a/src/servers/Server_REST/SapphireAPI.h b/src/servers/Server_REST/SapphireAPI.h
index abb48f72..1a79f2a0 100644
--- a/src/servers/Server_REST/SapphireAPI.h
+++ b/src/servers/Server_REST/SapphireAPI.h
@@ -31,6 +31,8 @@ namespace Core
void deleteCharacter( std::string name, uint32_t accountId );
+ bool insertSession( const uint32_t& accountId, std::string& sId );
+
std::vector getCharList( uint32_t accountId );
bool checkNameTaken( std::string name );
diff --git a/src/servers/Server_REST/main.cpp b/src/servers/Server_REST/main.cpp
index bfbb65f3..04fb7b48 100644
--- a/src/servers/Server_REST/main.cpp
+++ b/src/servers/Server_REST/main.cpp
@@ -289,6 +289,46 @@ int main()
};
+ server.resource["^/sapphire-api/lobby/insertSession"]["POST"] = [&server]( shared_ptr response, shared_ptr request ) {
+ print_request_info( request );
+
+ try
+ {
+ using namespace boost::property_tree;
+ ptree pt;
+ read_json( request->content, pt );
+
+ std::string sId = pt.get( "sId" );
+ uint32_t accountId = pt.get( "accountId" );
+ std::string secret = pt.get( "secret" );
+
+ auto m_pConfig = new Core::XMLConfig();
+
+ if( !m_pConfig->loadConfig( "config/settings_rest.xml" ) )
+ {
+ g_log.fatal( "Error loading config settings_rest.xml" );
+ return 1;
+ }
+
+ if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret ) {
+ std::string json_string = "{\"result\":\"invalid_secret\"}";
+ *response << "HTTP/1.1 403\r\nContent-Length: " << json_string.length() << "\r\n\r\n" << json_string;
+ }
+ else
+ {
+ g_sapphireAPI.insertSession( accountId, sId );
+ std::string json_string = "{\"result\":\"success\"}";
+ *response << "HTTP/1.1 200\r\nContent-Length: " << json_string.length() << "\r\n\r\n" << json_string;
+ }
+ }
+ catch( exception& e )
+ {
+ *response << "HTTP/1.1 500\r\n\r\n";
+ g_log.error( e.what() );
+ }
+
+ };
+
server.resource["^/sapphire-api/lobby/checkNameTaken"]["POST"] = [&server]( shared_ptr response, shared_ptr request ) {
print_request_info( request );
diff --git a/src/tools/Script/ps4dns.py b/src/tools/Script/ps4dns.py
new file mode 100644
index 00000000..fa7873c7
--- /dev/null
+++ b/src/tools/Script/ps4dns.py
@@ -0,0 +1,53 @@
+import socket
+from urllib2 import urlopen
+
+class DNSQuery:
+ def __init__(self, data):
+ self.data=data
+ self.domain=''
+
+ qtype = (ord(data[2]) >> 3) & 15 # Opcode bits
+ if qtype == 0: # Standard query
+ index=12
+ lon=ord(data[index])
+ while lon != 0:
+ self.domain+=data[index+1:index+lon+1]+'.'
+ index+=lon+1
+ lon=ord(data[index])
+
+ def request(self, ip):
+ packet=''
+ if self.domain:
+ packet+=self.data[:2] + "\x81\x80"
+ packet+=self.data[4:6] + self.data[4:6] + '\x00\x00\x00\x00' # Questions and Answers Counts
+ packet+=self.data[12:] # Original Domain Name Question
+ packet+='\xc0\x0c' # Pointer to domain name
+ packet+='\x00\x01\x00\x01\x00\x00\x00\x3c\x00\x04' # Response type, ttl and resource data length -> 4 bytes
+ packet+=str.join('',map(lambda x: chr(int(x)), ip.split('.'))) # 4bytes of IP
+ return packet
+
+if __name__ == '__main__':
+ #ip=socket.gethostbyname(socket.gethostname())
+ #ip = urlopen('http://ip.42.pl/raw').read()
+ ip = "212.43.86.40"
+ print 'DNS server started on %s intercepting to %s' % (socket.gethostbyname(socket.gethostname()), ip)
+
+ udps = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ udps.bind(('',53))
+
+ try:
+ while 1:
+ data, addr = udps.recvfrom(1024)
+ p=DNSQuery(data)
+ if "neolobby" in p.domain:
+ udps.sendto(p.request(ip), addr) #send answer
+ print 'Intercepted request: %s -> %s' % (p.domain, ip)
+ else:
+ try:
+ r_ip = socket.gethostbyname(p.domain)
+ except:
+ r_ip = ip
+ udps.sendto(p.request(r_ip), addr) #send answer
+ print 'Normal request: %s -> %s' % (p.domain, r_ip)
+ except KeyboardInterrupt:
+ udps.close()
\ No newline at end of file