I wrote a module based on LUCI and now I am finding a way to compile these files into binary.
As found on COMPEX's access points, their modified LUCI files are all binary files. So this is quite good for hiding some important modules, how can I do that? Any help will be appreciated and thanks
Topic: How can I compile LUCI into binary?
The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.
No, I don't think the module files are compiled into binary. I wrote some applications, but the process is much similar. You put your files in the directory maybe "modules", and make some modification in makefile, perhaps some more changes some where else. After all the work, the files will be copied to different directories when you compile the files. But they are just your original files. These files and directories will composed of the file structure of AP. There are some binary file.
Well, the ap system will compile the .lua file under the controller into binary and store them in a file named luci-indexcache and luci-modulecache for modules I tell from the directory name. The binary files is for efficiency. They are compiled in run time. So This is what I know about it. I hope it can help. If something wrong, please let me know, discussion is always appreciated.
Best wishes
Wandy
No, I don't think the module files are compiled into binary. I wrote some applications, but the process is much similar. You put your files in the directory maybe "modules", and make some modification in makefile, perhaps some more changes some where else. After all the work, the files will be copied to different directories when you compile the files. But they are just your original files. These files and directories will composed of the file structure of AP. There are some binary file.
Well, the ap system will compile the .lua file under the controller into binary and store them in a file named luci-indexcache and luci-modulecache for modules I tell from the directory name. The binary files is for efficiency. They are compiled in run time. So This is what I know about it. I hope it can help. If something wrong, please let me know, discussion is always appreciated.
Best wishes
Wandy
Thanks Wandy. As I found on my COMPEX's box, all of LUCI controller and CBI model files are in binary format (still come with extension of *.lua), and I cannot read the content as text file as usual.
As in http://lua-users.org/wiki/LuaTools , I can found a lot of tools for compile LUA file such as LUADEC51, but do not know how to use them in OpenWrt. I tried to decompile some files I took from my box but failed.
This is content from controller file named system.lua:
LuaQ A@ …€ †À@@€$ $@ @ $€ € $À À $ $@ @ $€ € $À À € module luci.controller.admin.system package seeall index action_clock_status action_packages action_flashops action_passwd action_reboot
fork_exec ltn12_popen 7 J @ Á€ b@ …À Á@ A œ€ Å A Ü€ €€ ƒ J €@ Á€ b@€…@ Á€ œ€ Å A Ü€ Á @€ J €@ Á€ b@€…@ Á€ œ @ J €@ Á€ A b@€…@ ÁÀ œ€ Š܀ A @€ J €@ Á€ b@€…@ ÁÀ œ€ Š܀ A @€€ ÀE F A@ € À€ J €@ Á€ b@€…@ ÁÀ œ€ Š܀ A @€ €€ ÀE F A€ € @
€ J €@ Á€ Á b@€…@ Á œ€ Å A Ü€ @€ J @ Á€ Á AÁ b@ … Á@ œ @ À€ J €@ Á€ b@€… ÁÀ œ€ Å
Ü€ A
@€ J €@ Á€
b@€… ÁÀ
œ€ Š܀ A @€€ ÀE F A€ € À € J €@ Á€ Á b@€…@ Á œ€ Å A Ü€ @€ J @ Á€ Á AÁ b@ …@ Á
œ€ Ă €€  J @ Á€ Á A
b@ …@ ÁÀ
œ€ Ă €€ € ÀE F A € @€ J €@ Á€ A b@€…@ Á€ œ€ Å Á Ü€ @€ J €@ Á€ A b@€…@ Á€ œ€ Å Á Ü€ @€ J @ Á€ A AA b@ … Á€ œ @ J €@ Á€ Á b@€…@ Á œ€ Å A Ü€ @€ € G entry admin system alias _ System index cbi admin_system/system
clock_status call action_clock_status admin_system/admin Administration services admin_system/services Services nixio fs access /usr/sbin/snmpd snmp admin_system/snmp SNMP
/bin/opkg packages action_packages Software
ipkg form admin_system/ipkg startup admin_system/startup Startup - crontab admin_system/crontab Scheduled Tasks . /etc/config/fstab fstab admin_system/fstab
Mount Points 2 mount admin_system/fstab/mount leaf swap admin_system/fstab/swap /sys/class/leds leds admin_system/leds < <abbr title="Light Emitting Diode">LED</abbr> Configuration < flashops action_flashops Backup / Flash Firmware F backupfiles admin_system/backupfiles reboot action_reboot Reboot Z 9 F
/ E@ F€À FÀÀ \ € W@A @€ ƒÀ€EÀ F  @ À \€€Z €…@ †€B†ÀBÊ AĂ FĂ †ÁĂ ÆÄ BÄ F‚Ä â@ ĐÀ †œ@ E@ F€À FÀÄ \@ E@ F€À F@Å @ ÅÀ Æ ÂÁ Ü€ ‰À ‹\@ € tonumber luci http
formvalue set os date *t sys call ( date -s '%04d-%02d-%02d %02d:%02d:%02d' year month day hour min sec prepare_content application/json write_json timestring %c H ¸ ó A@ € E€ FÀÀ F Á @ \€ ‚ Ê
J€ bA€ € Á ¢A€ Ă E‚ FÂÀFÁ \‚ ZB €A …B †‚BÅ‚ ÆÂÀÆÁĂ Ü‚ ÚB €Á C œ‚€W€CÀ €€‚‡À € D@ €B €Â Å‚ ÆÂÀÆÁC Ü‚ W€Á@ €ÚB €Ă€€ €ƒ Ă@AAƒ ƒ C€…ƒ †Ă@†AÁĂ œƒ €W€A€ €Z €@ €ÆƒD Ü €À ÉÀÔ€̀CĂIÁÔ ̀CÉ‚‚ € Z @€Ă€„ EDE@€ €…D @€ À€
É …€EC
IÁ
EC
‰
‚ € !D üÛ€ €Åƒ ÆĂÀÆÁ„ ܃ Ú €„E @€ À€ „€DCIÁ DC‰‚ € „ Ä@AAÄ „ €€FÄE \ € À €T€LDĂIÁT LDÉ‚E„ FÄÀFÁ \„ Z €€†F œ
À€ @ ”€ŒDC IÁ ” ŒDC ‰ ‚€  E …F
ÅF
A … €@
ƒ€À€‚ EF F†ÆFFÇ À •Æ
\† € €F†G…Æ †H
œ†€ FH
€†@ €Â€ @ €aE @úE… F…È
FÅÈ
ÊÅ ÉE‚ƒÉ…‚…ÉÅ‚ˆÉÅ ‰É‹É„‹ÉEŒÉ…„’ÉÅ“
FJ@€† †€É†“
FJ@ † †€É•\E€ €EE F…Æ
FÅÊ
\E € - require luci.model.ipkg luci http
formvalue submit display
installed string byte letter A # A Z query install url util imatch remove update upgrade nixio fs dir /var/opkg-lists/ stat mtime os time €Q template render admin_system/packages no_lists
old_lists stdout table concat stderr unlink /tmp/luci-indexcache º C A@ € E € \€ …À † A†@AÁ€ œ€ ÅÀ Æ ÂA Ü€ W€Â €Â@  € Á A A ä $B d‚ ƒ Å‚ ÆÂĂÆÄ$Ă ÜB Å‚ ÆÂĂÆBă Ü‚ Ú @€Å €Ü‚ ƒ ĂCEAC € Ń ÆĂÅÆÆÜƒ€ Ä DFA„ ¢C ƒ‹C€ƒ ĂCĂFA C ƒ CGƒGĂG@€…ƒ †ĂC†HC€€.€Å‚ ÆÂĂÆBÄC Ü‚ Ú À€Å‚ ÆÂĂÆBă Ü‚ Ú +€€ …@*€ƒ ĂHIAC C ƒ ĂEƒIC€ À'€Å‚ ÆÂĂÆBÄĂ Ü‚ ÚB €€Å‚ ÆÂĂÆBÄ
Ü‚ Ú @€ÅB
ƒ ĂCCDA
ƒ C €ƒ
Ü‚ €Ê€€ €ƒ€ À€ƒ ĂHIAĂ
À ܃€ ‰Ă–À€Üƒ€ ‰Ăƒ–ÅĂ ÆÁÆĂË Üƒ ÆƒË‰Ă—Åƒ ÆĂĂÆCÄ Üƒ Ó€Ó€‰Ă˜C€@€Ă ACL@ C ƒ ĂHIAƒ Ă ‰Ă€™‰ƒ ‰ƒÍC€€€ÀÍ €ƒ ĂCCDA ƒ N€ €C C €ƒ Eƒ FĂÈFÉC ÊĂ „ ODOA„ „ É„„ ODOA „ É„Ÿ …€ €„ D € É„ \C€EĂ À ¢C ƒ¢\C À €Ú @€Å‚ ÆÂĂÆBÄC Ü‚ Ú €€Å‚ ÆÂÈÆÉC JĂ …ƒ †O†COÁƒ œƒ Iƒƒ…ƒ †O†COÁĂ œƒ IƒƒŸIƒĐ ÜB€Å ÜB À€Å‚ ÆÂÈÆÉƒ Jƒ IĂ€™Iƒ ÜB€ € I require luci.sys luci.fs nixio fs access /lib/upgrade/platform.sh os execute / grep '"rootfs_data"' /proc/mtd >/dev/null 2>&1 tar -xzC/ >/dev/null 2>&1 ) sysupgrade --create-backup - 2>/dev/null /tmp/firmware.img luci http setfilehandler
formvalue backup ltn12_popen header Content-Disposition + attachment; filename="backup-%s-%s.tar.gz" sys hostname date %Y-%m-%d prepare_content application/x-targz ltn12 pump all write restore archive template render admin_system/applyreboot reboot image step tonumber admin_system/upgrade checksum storage size stat keep unlink admin_system/flashops reset_avail upgrade_avail image_invalid 1 -n title i18n
translate Flashing... msg ç The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes until you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings. addr 192.168.1.1
fork_exec 9 killall dropbear uhttpd; sleep 1; /sbin/sysupgrade %s %q reset Erasing... \ The system is erasing the configuration partition now and will reboot itself when finished. > killall -9 dropbear uhttpd; sleep 1; mtd -r erase rootfs_data Å Í @ €@ AÀ Ä ĐÀ€‚UÀ€ € W € €@ € € os execute . /lib/functions.sh; include /lib/upgrade; # platform_check_image %q >/dev/null Ï Ñ @@ €@ D P@€€ A @ €€ € luci sys exec
md5sum %q match
^([^%s]+) Ó ç > E@ F€À FÀÀ \€ Z €E@ F€Á \ €KÁAÁ \AW@B@ €€B@€E € Á \‚€ €@€a@ ü€€E@ F€À FÀÀ @ \€ Z À€E@ F€Á @ \ €KÁAÁ \AÚ À€ @€KÂAÁ \‚€ZB €E €€\‚ Ä@ €a@ û € nixio fs access
/proc/mtd io lines match - ^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)" linux firmware tonumber /proc/partitions ( ^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+) [0-9] ́ ú ! Ä Ú@ @€ @€Æ @ @À€€Å€ ÆÀÀ€ A Ü€€È @€Å€ Æ@Á A Ü€€È Z À €Ä Ë€Á@€ Ü@€ € €Ä ËÀÁÜ@ € name image io open w popen write close E S # @@ €@ AÀ € E F@À F€À \€ ƒ @ @ €Z À€@ €Å Æ@ÁÆ€ÁÆÀÁ @ Ü€€€ € €@ Å Æ€ÂÆÀ JA I€†Ü@€ € luci http
formvalue pwd1 pwd2 sys user
setpasswd root
template render admin_system/passwd stat U [ @@ €@ AÀ € E F Á F@Á € Ê@ É €\@€ À €E FÀÁ FÀÀ \@€ € luci http
formvalue reboot template render admin_system/reboot sys ] s 3 E F@À \€€ @ @ € € €
€€À
€… †À@Á œ@ … †@AÁ€ Á œ€€ À€Å Æ Â E FAÂÜ@€Å Æ Â E FÂÜ@€Å Æ Â E FÁÂÜ@€Ë CÜ€ À€†@ €Ë€CÜ@ Å ÆÀĂ AA € Ü@ € nixio fork chdir / open
/dev/null w+ dup stderr stdout stdin fileno close exec /bin/sh -c u ‘ % E F@À \À€ ŠƀÀÜ€€ À€@€AA d € € ^ # @€ÀÀÀ€ AA@ … †AA€Á A AA ÁAA A À A €
nixio pipe fork close dup stdout exec /bin/sh -c } " @ @ €€E€ FÀÀ „ € Á \À€Ä Ú@ @€Z À €@A@ €Â € È €Ô À ƒ@ € À€Ä Ú €Ä ËÀÁÜ@ Ă €̃ € read nixio waitpid nohang exited close
Anymore idea?
(Last edited by daaulinh on 24 Nov 2014, 12:18)
Fire up "make menuconfig" and have a look at "LuCI ---> Libraries ---> Build Target". In there, you can select that everything will be precompiled.
The discussion might have continued from here.