Jump to content




Bypass disk override?


  • You cannot reply to this topic
9 replies to this topic

#1 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 20 May 2015 - 10:31 AM

So. We all know that a file named startup will override the one on the computer. I'm wondering if there's any way to bypass this? Like, make the startup file on the computer run regardless of the startup file on the disk.

Thanks - Mackan

#2 flaghacker

  • Members
  • 655 posts

Posted 20 May 2015 - 10:51 AM

There's no ingame way, but you (or the server owner in multiplayer) can edit the computercraft rom to prevent it.

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 May 2015 - 11:00 AM

A disk with a higher "priority" could be used to with a startup script to run the computer's startup script. The highest "priority" disk drive is the top as it is the first place checked for a startup.

#4 HDeffo

  • Members
  • 214 posts

Posted 20 May 2015 - 11:28 AM

Depending on what version of ComputerCraft you are using contrary to popular belief all but the newest versions you can actually bypass disk/startup files. The string metatable is exposed in older versions of the mod and when you edit this it remains until the server restarts or someone else changes the metatable. There is a section just before disk/startup is run that uses gsub which will run your metatable program effectively bypassing the disk if you make it do that.


Please note this would be slightly hackish and dirty code but if we are being honest since most modpacks aren't fully up to date yet, yes it is possible

Edited by HDeffo, 20 May 2015 - 11:29 AM.


#5 valithor

  • Members
  • 1,053 posts

Posted 20 May 2015 - 01:19 PM

View Postflaghacker, on 20 May 2015 - 10:51 AM, said:

There's no ingame way, but you (or the server owner in multiplayer) can edit the computercraft rom to prevent it.

For most new versions you no longer edit the jar to make changes. Instead the new method is to put a resource pack in a resource pack folder in the server files, and it will automatically use whatever you put in the resource pack to overwrite the original (with the exception of the bios). In order to prevent disk startup the program you would want to modify is /rom/startup

Edited by valithor, 20 May 2015 - 01:20 PM.


#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 20 May 2015 - 04:28 PM

View PostHDeffo, on 20 May 2015 - 11:28 AM, said:

There is a section just before disk/startup is run that uses gsub [...]

Where, exactly, is this call you refer to? A quick glance through the current /rom/startup and the current /rom/programs/shell turned up nothing.

#7 HDeffo

  • Members
  • 214 posts

Posted 20 May 2015 - 04:58 PM

View PostLyqyd, on 20 May 2015 - 04:28 PM, said:

View PostHDeffo, on 20 May 2015 - 11:28 AM, said:

There is a section just before disk/startup is run that uses gsub [...]

Where, exactly, is this call you refer to? A quick glance through the current /rom/startup and the current /rom/programs/shell turned up nothing.

I am not exactly sure honestly....

(please note all of the following is outdated so if you are trying to bypass the disk on the current version ignore the following)
Spoiler


#8 Anavrins

  • Members
  • 775 posts

Posted 20 May 2015 - 08:35 PM

View PostHDeffo, on 20 May 2015 - 11:28 AM, said:

Depending on what version of ComputerCraft you are using contrary to popular belief all but the newest versions you can actually bypass disk/startup files. The string metatable is exposed in older versions of the mod and when you edit this it remains until the server restarts or someone else changes the metatable. There is a section just before disk/startup is run that uses gsub which will run your metatable program effectively bypassing the disk if you make it do that.


Please note this would be slightly hackish and dirty code but if we are being honest since most modpacks aren't fully up to date yet, yes it is possible
You're almost right, there is a string.sub being used in "/rom/startup", however the metatable bug could only be used again calls that uses the metatable, in other words, with a colon, example: str:sub(1,3).

#9 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 20 May 2015 - 10:51 PM

The only way to not call the __index metamethod would be to use rawget. string.sub, str:sub, string["sub"] will all call the __index metamathod. (This is, of course, assuming they are already indexes - setting an index would trigger __newindex).

#10 HDeffo

  • Members
  • 214 posts

Posted 21 May 2015 - 01:18 AM

It isn't a matter of me being almost right. I actually use this method on a server I run for cross computer communication so I know it works.

@avavrins: that's a different function and not what triggers my code. The function that triggers it is :gsub although I don't know in which program it is is I only know it somehow happens only if __index is a function and not a table and happens before disk/startup.

@KingofGamesYami: the string table and the string metatable are two different tables calling one will not trigger the other. The metatable exists within each string and exists within that string. The string table is a table of functions within the global table _G. In standard computercraft string.len() does not call str:len() and visa versa. My code takes advantage of this and makes it so str:len() DOES call string.len() but this still doesn't occur the way so there isn't a loop.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users