mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
nirai: aes --> xor for byte obfuscation, add toon takeover command, change prefix to stride-beta
This commit is contained in:
parent
bc8840da42
commit
58275c061e
5 changed files with 68 additions and 24 deletions
|
@ -29,10 +29,15 @@ def niraicall_obfuscate(code):
|
||||||
# Reverse
|
# Reverse
|
||||||
code = code[::-1]
|
code = code[::-1]
|
||||||
|
|
||||||
# AES
|
# XOR
|
||||||
key = ''.join(chr((i ^ (9 * i + 81)) % ((i + 193) * 11)) for i in xrange(16))
|
key = ['B', 'A', 'Q', 'J', 'R', 'P', 'Z', 'P', 'A', 'H', 'U', 'T']
|
||||||
iv = ''.join(chr((i ^ (5 * i + 170)) % ((i + 38) * 7)) for i in xrange(16))
|
output = []
|
||||||
code = aes.encrypt(code, key, iv)
|
|
||||||
|
for i in range(len(code)):
|
||||||
|
xor_num = ord(code[i]) ^ ord(key[i % len(key)])
|
||||||
|
output.append(chr(xor_num))
|
||||||
|
|
||||||
|
code = ''.join(output)
|
||||||
|
|
||||||
return True, code
|
return True, code
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3d29188a91b658f61cd2c3b3b8ada23050d4f230
|
Subproject commit f1b859ed19c77f14ccdab22f3cd7ce82de2acede
|
|
@ -145,21 +145,12 @@ extern "C" PyObject* niraicall_deobfuscate(char* code, Py_ssize_t size)
|
||||||
{
|
{
|
||||||
std::string codestr(code, size);
|
std::string codestr(code, size);
|
||||||
|
|
||||||
// AES
|
char key[12] = {'B', 'A', 'Q', 'J', 'R', 'P', 'Z', 'P', 'A', 'H', 'U', 'T'};
|
||||||
unsigned char* aes_decrypted = new unsigned char[size];
|
std::string output = codestr;
|
||||||
unsigned char key[16];
|
|
||||||
unsigned char iv[16];
|
for (int i = 0; i < codestr.size(); i++)
|
||||||
|
output[i] = codestr[i] ^ key[i % (sizeof(key) / sizeof(char))];
|
||||||
for (int i = 0; i < 16; ++i)
|
|
||||||
key[i] = (i ^ (9 * i + 81)) % ((i + 193) * 11);
|
|
||||||
|
|
||||||
for (int i = 0; i < 16; ++i)
|
|
||||||
iv[i] = (i ^ (5 * i + 170)) % ((i + 38) * 7);
|
|
||||||
|
|
||||||
int decsize = AES_decrypt((unsigned char*)code, size, key, iv, aes_decrypted);
|
|
||||||
|
|
||||||
std::string output((char*)aes_decrypted, decsize);
|
|
||||||
std::reverse(output.begin(), output.end());
|
std::reverse(output.begin(), output.end());
|
||||||
delete[] aes_decrypted;
|
return PyString_FromStringAndSize(output.data(), size);
|
||||||
return PyString_FromStringAndSize(output.data(), decsize);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
"astron": "6b769e6",
|
"astron": "6b769e6",
|
||||||
"panda3d": "b924139",
|
"panda3d": "b924139",
|
||||||
"libpandadna": "a0047ce",
|
"libpandadna": "a0047ce",
|
||||||
"version-prefix": "tts-beta-",
|
"version-prefix": "stride-beta-",
|
||||||
"server-resources": ["pdna", "txt", "dat", "bam", "ttf"]
|
"server-resources": ["pdna", "txt", "dat", "bam", "ttf"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -3126,6 +3126,24 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
|
||||||
self.zoneId))
|
self.zoneId))
|
||||||
return ['success', suitIndex, building.doId]
|
return ['success', suitIndex, building.doId]
|
||||||
|
|
||||||
|
def doToonBuildingTakeover(self):
|
||||||
|
streetId = ZoneUtil.getBranchZone(self.zoneId)
|
||||||
|
if streetId not in self.air.suitPlanners:
|
||||||
|
self.notify.warning('Street %d is not known.' % streetId)
|
||||||
|
return ['badlocation', 'notknownstreet', 0]
|
||||||
|
sp = self.air.suitPlanners[streetId]
|
||||||
|
bm = sp.buildingMgr
|
||||||
|
building = self.findClosestSuitDoor()
|
||||||
|
if building == None:
|
||||||
|
return ['badlocation', 'nobuilding', 0]
|
||||||
|
if building.isToonBlock():
|
||||||
|
return ['badlocation', 'toonblock', 0]
|
||||||
|
building.toonTakeOver()
|
||||||
|
self.notify.warning('toonTakeOverFromStreet %s %d' % (building.block,
|
||||||
|
self.zoneId))
|
||||||
|
|
||||||
|
return ['success', building.doId]
|
||||||
|
|
||||||
def doCogdoTakeOver(self, suitIndex):
|
def doCogdoTakeOver(self, suitIndex):
|
||||||
if suitIndex >= len(SuitDNA.suitHeadTypes):
|
if suitIndex >= len(SuitDNA.suitHeadTypes):
|
||||||
self.notify.warning('Bad suit index: %s' % suitIndex)
|
self.notify.warning('Bad suit index: %s' % suitIndex)
|
||||||
|
@ -3298,6 +3316,31 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def findClosestSuitDoor(self):
|
||||||
|
zoneId = self.zoneId
|
||||||
|
streetId = ZoneUtil.getBranchZone(zoneId)
|
||||||
|
sp = self.air.suitPlanners[streetId]
|
||||||
|
if not sp:
|
||||||
|
return None
|
||||||
|
bm = sp.buildingMgr
|
||||||
|
if not bm:
|
||||||
|
return None
|
||||||
|
zones = [zoneId,
|
||||||
|
zoneId - 1,
|
||||||
|
zoneId + 1,
|
||||||
|
zoneId - 2,
|
||||||
|
zoneId + 2]
|
||||||
|
for zone in zones:
|
||||||
|
for i in bm.getSuitBlocks():
|
||||||
|
building = bm.getBuilding(i)
|
||||||
|
extZoneId, intZoneId = building.getExteriorAndInteriorZoneId()
|
||||||
|
if not NPCToons.isZoneProtected(intZoneId):
|
||||||
|
if hasattr(building, 'elevator'):
|
||||||
|
if building.elevator.zoneId == zone:
|
||||||
|
return building
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
def b_setGardenTrophies(self, trophyList):
|
def b_setGardenTrophies(self, trophyList):
|
||||||
self.setGardenTrophies(trophyList)
|
self.setGardenTrophies(trophyList)
|
||||||
self.d_setGardenTrophies(trophyList)
|
self.d_setGardenTrophies(trophyList)
|
||||||
|
@ -4925,8 +4968,8 @@ def track(command, track, value=None):
|
||||||
return 'Set the experience of the %s track to: %d!' % (track, value)
|
return 'Set the experience of the %s track to: %d!' % (track, value)
|
||||||
return 'Invalid command.'
|
return 'Invalid command.'
|
||||||
|
|
||||||
@magicWord(category=CATEGORY_PROGRAMMER, types=[str, str])
|
@magicWord(category=CATEGORY_ADMINISTRATOR, types=[str, str])
|
||||||
def suit(command, suitName):
|
def suit(command, suitName = 'unset'):
|
||||||
invoker = spellbook.getInvoker()
|
invoker = spellbook.getInvoker()
|
||||||
command = command.lower()
|
command = command.lower()
|
||||||
if suitName not in SuitDNA.suitHeadTypes:
|
if suitName not in SuitDNA.suitHeadTypes:
|
||||||
|
@ -4942,6 +4985,11 @@ def suit(command, suitName):
|
||||||
if returnCode[0] == 'success':
|
if returnCode[0] == 'success':
|
||||||
return 'Successfully spawned a Cog building with: ' + suitFullName
|
return 'Successfully spawned a Cog building with: ' + suitFullName
|
||||||
return "Couldn't spawn a Cog building with: " + suitFullName
|
return "Couldn't spawn a Cog building with: " + suitFullName
|
||||||
|
elif command == 'nobuilding':
|
||||||
|
returnCode = invoker.doToonBuildingTakeover()
|
||||||
|
if returnCode[0] == 'success':
|
||||||
|
return 'Toons took over the cog building!'
|
||||||
|
return "Couldn't allow toons to take over cog building because " + returnCode[1]
|
||||||
else:
|
else:
|
||||||
return 'Invalid command.'
|
return 'Invalid command.'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue