Repository: Gallopsled/pwntools

Issue:
pwn constgrep a throws an exception
Ugh, this seems wrong:

```
root@pwndbg:~# pwn constgrep a
Traceback (most recent call last):
  File "/usr/local/bin/pwn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/pwnlib/commandline/main.py", line 58, in main
    commands[args.command](args)
  File "/usr/local/lib/python3.10/dist-packages/pwnlib/commandline/constgrep.py", line 110, in main
    for _, k in sorted(out):
TypeError: '<' not supported between instances of 'Constant' and 'type'
```


Discussion:
I have printed `out` before the loop and it is:
```
[(Constant('AF_ATMPVC', 0x8), 'AF_ATMPVC'), (Constant('AF_ATMSVC', 0x14), 'AF_ATMSVC'), (Constant('AF_CAIF', 0x25), 'AF_CAIF'), (Constant('AF_CAN', 0x1d), 'AF_CAN'), (Constant('AF_DECnet', 0xc), 'AF_DECnet'), (Constant('AF_ECONET', 0x13), 'AF_ECONET'), (Constant('AF_IUCV', 0x20), 'AF_IUCV'), (Constant('AF_KCM', 0x29), 'AF_KCM'), (Constant('AF_LLC', 0x1a), 'AF_LLC'), (Constant('AF_LOCAL', 0x1), 'AF_LOCAL'), (Constant('AF_NFC', 0x27), 'AF_NFC'), (Constant('AF_PACKET', 0x11), 'AF_PACKET'), (Constant('AF_QIPCRTR', 0x2a), 'AF_QIPCRTR'), (Constant('AF_RXRPC', 0x21), 'AF_RXRPC'), (Constant('AF_SECURITY', 0xe), 'AF_SECURITY'), (Constant('AF_SMC', 0x2b), 'AF_SMC'), (Constant('AF_TIPC', 0x1e), 'AF_TIPC'), (Constant('AF_UNSPEC', 0x0), 'AF_UNSPEC'), (Constant('AF_VSOCK', 0x28), 'AF_VSOCK'), (Constant('AI_ADDRCONFIG', 0x10), 'AI_ADDRCONFIG'), (Constant('AI_CANONNAME', 0x2), 'AI_CANONNAME'), (Constant('AI_NUMERICHOST', 0x1), 'AI_NUMERICHOST'), (Constant('AI_NUMERICSERV', 0x8), 'AI_NUMERICSERV'), (Constant('AT_EACCESS', 0x200), 'AT_EACCESS'), (Constant('AT_FDCWD', -0x64), 'AT_FDCWD'), (Constant('CS', 0xd), 'CS'), (<class 'pwnlib.constants.constant.Constant'>, 'Constant'), (Constant('EACCES', 0xd), 'EACCES'), (Constant('EAI_SERVICE', -0x5), 'EAI_SERVICE'), (Constant('EAI_SOCKTYPE', -0x2), 'EAI_SOCKTYPE'), (Constant('EBADRQC', 0x38), 'EBADRQC'), (Constant('ECANCELED', 0x7d), 'ECANCELED'), (Constant('ECHILD', 0xa), 'ECHILD'), (Constant('ECHRNG', 0x2c), 'ECHRNG'), (Constant('ECOMM', 0x46), 'ECOMM'), (Constant('ECONNABORTED', 0x67), 'ECONNABORTED'), (Constant('ECONNREFUSED', 0x6f), 'ECONNREFUSED'), (Constant('ECONNRESET', 0x68), 'ECONNRESET'), (Constant('ECX', 0x1), 'ECX'), (Constant('EDEADLOCK', 0x23), 'EDEADLOCK'), (Constant('EHOSTUNREACH', 0x71), 'EHOSTUNREACH'), (Constant('EISCONN', 0x6a), 'EISCONN'), (Constant('EKEYREJECTED', 0x81), 'EKEYREJECTED'), (Constant('EL2NSYNC', 0x2d), 'EL2NSYNC'), (Constant('ELIBACC', 0x4f), 'ELIBACC'), (Constant('ELIBEXEC', 0x53), 'ELIBEXEC'), (Constant('ELIBSCN', 0x51), 'ELIBSCN'), (Constant('ENETUNREACH', 0x65), 'ENETUNREACH'), (Constant('ENOCSI', 0x32), 'ENOCSI'), (Constant('ENOEXEC', 0x8), 'ENOEXEC'), (Constant('ENOLCK', 0x25), 'ENOLCK'), (Constant('ENOSPC', 0x1c), 'ENOSPC'), (Constant('ENOTCONN', 0x6b), 'ENOTCONN'), (Constant('ENOTRECOVERABLE', 0x83), 'ENOTRECOVERABLE'), (Constant('ENOTSOCK', 0x58), 'ENOTSOCK'), (Constant('EREMCHG', 0x4e), 'EREMCHG'), (Constant('ESOCKTNOSUPPORT', 0x5e), 'ESOCKTNOSUPPORT'), (Constant('ESRCH', 0x3), 'ESRCH'), (Constant('EUCLEAN', 0x75), 'EUCLEAN'), (Constant('EUNATCH', 0x31), 'EUNATCH'), (Constant('EWOULDBLOCK', 0xb), 'EWOULDBLOCK'), (Constant('FASYNC', 0x2000), 'FASYNC'), (Constant('FD_CLOEXEC', 0x1), 'FD_CLOEXEC'), (Constant('F_EXLCK', 0x4), 'F_EXLCK'), (Constant('F_LINUX_SPECIFIC_BASE', 0x400), 'F_LINUX_SPECIFIC_BASE'), (Constant('F_LOCK', 0x1), 'F_LOCK'), (Constant('F_RDLCK', 0x0), 'F_RDLCK'), (Constant('F_SHLCK', 0x8), 'F_SHLCK'), (Constant('F_TLOCK', 0x2), 'F_TLOCK'), (Constant('F_ULOCK', 0x0), 'F_ULOCK'), (Constant('F_UNLCK', 0x2), 'F_UNLCK'), (Constant('F_WRLCK', 0x1), 'F_WRLCK'), (Constant('INADDR_BROADCAST', 0xffffffff), 'INADDR_BROADCAST'), (Constant('INADDR_LOOPBACK', 0x7f000001), 'INADDR_LOOPBACK'), (Constant('LOCK_EX', 0x2), 'LOCK_EX'), (Constant('LOCK_MAND', 0x20), 'LOCK_MAND'), (Constant('LOCK_NB', 0x4), 'LOCK_NB'), (Constant('LOCK_READ', 0x40), 'LOCK_READ'), (Constant('LOCK_RW', 0xc0), 'LOCK_RW'), (Constant('LOCK_SH', 0x1), 'LOCK_SH'), (Constant('LOCK_UN', 0x8), 'LOCK_UN'), (Constant('LOCK_WRITE', 0x80), 'LOCK_WRITE'), (Constant('MAP_EXECUTABLE', 0x1000), 'MAP_EXECUTABLE'), (Constant('MAP_LOCKED', 0x2000), 'MAP_LOCKED'), (Constant('MAP_NONBLOCK', 0x10000), 'MAP_NONBLOCK'), (Constant('MAP_STACK', 0x20000), 'MAP_STACK'), (Constant('MCL_CURRENT', 0x1), 'MCL_CURRENT'), (Constant('MCL_FUTURE', 0x2), 'MCL_FUTURE'), (Constant('MCL_ONFAULT', 0x4), 'MCL_ONFAULT'), (Constant('MLOCK_ONFAULT', 0x1), 'MLOCK_ONFAULT'), (Constant('MSG_BATCH', 0x40000), 'MSG_BATCH'), (Constant('MSG_CMSG_CLOEXEC', 0x40000000), 'MSG_CMSG_CLOEXEC'), (Constant('MSG_CONFIRM', 0x800), 'MSG_CONFIRM'), (Constant('MSG_CTRUNC', 0x8), 'MSG_CTRUNC'), (Constant('MSG_TRUNC', 0x20), 'MSG_TRUNC'), (Constant('MSG_ZEROCOPY', 0x4000000), 'MSG_ZEROCOPY'), (Constant('MS_ASYNC', 0x1), 'MS_ASYNC'), (Constant('MS_SYNC', 0x4), 'MS_SYNC'), (Constant('NI_NUMERICHOST', 0x2), 'NI_NUMERICHOST'), (Constant('NI_NUMERICSERV', 0x8), 'NI_NUMERICSERV'), (Constant('O_ACCMODE', 0x3), 'O_ACCMODE'), (Constant('O_ASYNC', 0x2000), 'O_ASYNC'), (Constant('O_CLOEXEC', 0x80000), 'O_CLOEXEC'), (Constant('O_CREAT', 0x40), 'O_CREAT'), (Constant('O_DIRECT', 0x4000), 'O_DIRECT'), (Constant('O_DIRECTORY', 0x10000), 'O_DIRECTORY'), (Constant('O_DSYNC', 0x1000), 'O_DSYNC'), (Constant('O_EXCL', 0x80), 'O_EXCL'), (Constant('O_NOCTTY', 0x100), 'O_NOCTTY'), (Constant('O_NONBLOCK', 0x800), 'O_NONBLOCK'), (Constant('O_SYNC', 0x101000), 'O_SYNC'), (Constant('O_TRUNC', 0x200), 'O_TRUNC'), (Constant('PF_ATMPVC', 0x8), 'PF_ATMPVC'), (Constant('PF_ATMSVC', 0x14), 'PF_ATMSVC'), (Constant('PF_CAIF', 0x25), 'PF_CAIF'), (Constant('PF_CAN', 0x1d), 'PF_CAN'), (Constant('PF_DECnet', 0xc), 'PF_DECnet'), (Constant('PF_ECONET', 0x13), 'PF_ECONET'), (Constant('PF_IUCV', 0x20), 'PF_IUCV'), (Constant('PF_KCM', 0x29), 'PF_KCM'), (Constant('PF_LLC', 0x1a), 'PF_LLC'), (Constant('PF_LOCAL', 0x1), 'PF_LOCAL'), (Constant('PF_NFC', 0x27), 'PF_NFC'), (Constant('PF_PACKET', 0x11), 'PF_PACKET'), (Constant('PF_QIPCRTR', 0x2a), 'PF_QIPCRTR'), (Constant('PF_RXRPC', 0x21), 'PF_RXRPC'), (Constant('PF_SECURITY', 0xe), 'PF_SECURITY'), (Constant('PF_SMC', 0x2b), 'PF_SMC'), (Constant('PF_TIPC', 0x1e), 'PF_TIPC'), (Constant('PF_UNSPEC', 0x0), 'PF_UNSPEC'), (Constant('PF_VSOCK', 0x28), 'PF_VSOCK'), (Constant('PROT_EXEC', 0x4), 'PROT_EXEC'), (Constant('PTRACE_ATTACH', 0x10), 'PTRACE_ATTACH'), (Constant('PTRACE_CONT', 0x7), 'PTRACE_CONT'), (Constant('PTRACE_DETACH', 0x11), 'PTRACE_DETACH'), (Constant('PTRACE_EVENT_CLONE', 0x3), 'PTRACE_EVENT_CLONE'), (Constant('PTRACE_EVENT_EXEC', 0x4), 'PTRACE_EVENT_EXEC'), (Constant('PTRACE_EVENT_EXIT', 0x6), 'PTRACE_EVENT_EXIT'), (Constant('PTRACE_EVENT_FORK', 0x1), 'PTRACE_EVENT_FORK'), (Constant('PTRACE_EVENT_VFORK', 0x2), 'PTRACE_EVENT_VFORK'), (Constant('PTRACE_EVENT_VFORK_DONE', 0x5), 'PTRACE_EVENT_VFORK_DONE'), (Constant('PTRACE_GETEVENTMSG', 0x4201), 'PTRACE_GETEVENTMSG'), (Constant('PTRACE_GETFPREGS', 0xe), 'PTRACE_GETFPREGS'), (Constant('PTRACE_GETFPXREGS', 0x12), 'PTRACE_GETFPXREGS'), (Constant('PTRACE_GETREGS', 0xc), 'PTRACE_GETREGS'), (Constant('PTRACE_GETSIGINFO', 0x4202), 'PTRACE_GETSIGINFO'), (Constant('PTRACE_KILL', 0x8), 'PTRACE_KILL'), (Constant('PTRACE_O_MASK', 0x7f), 'PTRACE_O_MASK'), (Constant('PTRACE_O_TRACECLONE', 0x8), 'PTRACE_O_TRACECLONE'), (Constant('PTRACE_O_TRACEEXEC', 0x10), 'PTRACE_O_TRACEEXEC'), (Constant('PTRACE_O_TRACEEXIT', 0x40), 'PTRACE_O_TRACEEXIT'), (Constant('PTRACE_O_TRACEFORK', 0x2), 'PTRACE_O_TRACEFORK'), (Constant('PTRACE_O_TRACESYSGOOD', 0x1), 'PTRACE_O_TRACESYSGOOD'), (Constant('PTRACE_O_TRACEVFORK', 0x4), 'PTRACE_O_TRACEVFORK'), (Constant('PTRACE_O_TRACEVFORKDONE', 0x20), 'PTRACE_O_TRACEVFORKDONE'), (Constant('PTRACE_PEEKDATA', 0x2), 'PTRACE_PEEKDATA'), (Constant('PTRACE_PEEKTEXT', 0x1), 'PTRACE_PEEKTEXT'), (Constant('PTRACE_PEEKUSER', 0x3), 'PTRACE_PEEKUSER'), (Constant('PTRACE_PEEKUSR', 0x3), 'PTRACE_PEEKUSR'), (Constant('PTRACE_POKEDATA', 0x5), 'PTRACE_POKEDATA'), (Constant('PTRACE_POKETEXT', 0x4), 'PTRACE_POKETEXT'), (Constant('PTRACE_POKEUSER', 0x6), 'PTRACE_POKEUSER'), (Constant('PTRACE_POKEUSR', 0x6), 'PTRACE_POKEUSR'), (Constant('PTRACE_SETFPREGS', 0xf), 'PTRACE_SETFPREGS'), (Constant('PTRACE_SETFPXREGS', 0x13), 'PTRACE_SETFPXREGS'), (Constant('PTRACE_SETOPTIONS', 0x15), 'PTRACE_SETOPTIONS'), (Constant('PTRACE_SETREGS', 0xd), 'PTRACE_SETREGS'), (Constant('PTRACE_SETSIGINFO', 0x4203), 'PTRACE_SETSIGINFO'), (Constant('PTRACE_SINGLESTEP', 0x9), 'PTRACE_SINGLESTEP'), (Constant('PTRACE_SYSCALL', 0x18), 'PTRACE_SYSCALL'), (Constant('PTRACE_TRACEME', 0x0), 'PTRACE_TRACEME'), (Constant('PT_ATTACH', 0x10), 'PT_ATTACH'), (Constant('PT_CONTINUE', 0x7), 'PT_CONTINUE'), (Constant('PT_DETACH', 0x11), 'PT_DETACH'), (Constant('PT_TRACE_ME', 0x0), 'PT_TRACE_ME'), (Constant('SA_NOCLDSTOP', 0x1), 'SA_NOCLDSTOP'), (Constant('SA_NOCLDWAIT', 0x2), 'SA_NOCLDWAIT'), (Constant('SA_ONSTACK', 0x8000000), 'SA_ONSTACK'), (Constant('SCM_CONNECT', 0x3), 'SCM_CONNECT'), (Constant('SCM_CREDENTIALS', 0x2), 'SCM_CREDENTIALS'), (Constant('SCM_RIGHTS', 0x1), 'SCM_RIGHTS'), (Constant('SCM_TIMESTAMP', 0x1d), 'SCM_TIMESTAMP'), (Constant('SCM_TIMESTAMPING', 0x25), 'SCM_TIMESTAMPING'), (Constant('SCM_TIMESTAMPING_OPT_STATS', 0x36), 'SCM_TIMESTAMPING_OPT_STATS'), (Constant('SCM_TIMESTAMPING_PKTINFO', 0x3a), 'SCM_TIMESTAMPING_PKTINFO'), (Constant('SCM_TIMESTAMPNS', 0x23), 'SCM_TIMESTAMPNS'), (Constant('SCM_WIFI_STATUS', 0x29), 'SCM_WIFI_STATUS'), (Constant('SEEK_CUR', 0x1), 'SEEK_CUR'), (Constant('SIGCHLD', 0x11), 'SIGCHLD'), (Constant('SIGCLD', 0x11), 'SIGCLD'), (Constant('SIGCONT', 0x12), 'SIGCONT'), (Constant('SIGWINCH', 0x1c), 'SIGWINCH'), (Constant('SIGXCPU', 0x18), 'SIGXCPU'), (Constant('SIG_BLOCK', 0x0), 'SIG_BLOCK'), (Constant('SIG_UNBLOCK', 0x1), 'SIG_UNBLOCK'), (Constant('SIOCADDDLCI', 0x8980), 'SIOCADDDLCI'), (Constant('SIOCADDMULTI', 0x8931), 'SIOCADDMULTI'), (Constant('SIOCADDRT', 0x890b), 'SIOCADDRT'), (Constant('SIOCDARP', 0x8953), 'SIOCDARP'), (Constant('SIOCDELDLCI', 0x8981), 'SIOCDELDLCI'), (Constant('SIOCDELMULTI', 0x8932), 'SIOCDELMULTI'), (Constant('SIOCDELRT', 0x890c), 'SIOCDELRT'), (Constant('SIOCDEVPRIVATE', 0x89f0), 'SIOCDEVPRIVATE'), (Constant('SIOCDIFADDR', 0x8936), 'SIOCDIFADDR'), (Constant('SIOCDRARP', 0x8960), 'SIOCDRARP'), (Constant('SIOCETHTOOL', 0x8946), 'SIOCETHTOOL'), (Constant('SIOCGARP', 0x8954), 'SIOCGARP'), (Constant('SIOCGIFADDR', 0x8915), 'SIOCGIFADDR'), (Constant('SIOCGIFBR', 0x8940), 'SIOCGIFBR'), (Constant('SIOCGIFBRDADDR', 0x8919), 'SIOCGIFBRDADDR'), (Constant('SIOCGIFCONF', 0x8912), 'SIOCGIFCONF'), (Constant('SIOCGIFCOUNT', 0x8938), 'SIOCGIFCOUNT'), (Constant('SIOCGIFDIVERT', 0x8944), 'SIOCGIFDIVERT'), (Constant('SIOCGIFDSTADDR', 0x8917), 'SIOCGIFDSTADDR'), (Constant('SIOCGIFENCAP', 0x8925), 'SIOCGIFENCAP'), (Constant('SIOCGIFFLAGS', 0x8913), 'SIOCGIFFLAGS'), (Constant('SIOCGIFHWADDR', 0x8927), 'SIOCGIFHWADDR'), (Constant('SIOCGIFINDEX', 0x8933), 'SIOCGIFINDEX'), (Constant('SIOCGIFMAP', 0x8970), 'SIOCGIFMAP'), (Constant('SIOCGIFMEM', 0x891f), 'SIOCGIFMEM'), (Constant('SIOCGIFMETRIC', 0x891d), 'SIOCGIFMETRIC'), (Constant('SIOCGIFMTU', 0x8921), 'SIOCGIFMTU'), (Constant('SIOCGIFNAME', 0x8910), 'SIOCGIFNAME'), (Constant('SIOCGIFNETMASK', 0x891b), 'SIOCGIFNETMASK'), (Constant('SIOCGIFPFLAGS', 0x8935), 'SIOCGIFPFLAGS'), (Constant('SIOCGIFSLAVE', 0x8929), 'SIOCGIFSLAVE'), (Constant('SIOCGIFTXQLEN', 0x8942), 'SIOCGIFTXQLEN'), (Constant('SIOCGRARP', 0x8961), 'SIOCGRARP'), (Constant('SIOCRTMSG', 0x890d), 'SIOCRTMSG'), (Constant('SIOCSARP', 0x8955), 'SIOCSARP'), (Constant('SIOCSIFADDR', 0x8916), 'SIOCSIFADDR'), (Constant('SIOCSIFBR', 0x8941), 'SIOCSIFBR'), (Constant('SIOCSIFBRDADDR', 0x891a), 'SIOCSIFBRDADDR'), (Constant('SIOCSIFDIVERT', 0x8945), 'SIOCSIFDIVERT'), (Constant('SIOCSIFDSTADDR', 0x8918), 'SIOCSIFDSTADDR'), (Constant('SIOCSIFENCAP', 0x8926), 'SIOCSIFENCAP'), (Constant('SIOCSIFFLAGS', 0x8914), 'SIOCSIFFLAGS'), (Constant('SIOCSIFHWADDR', 0x8924), 'SIOCSIFHWADDR'), (Constant('SIOCSIFHWBROADCAST', 0x8937), 'SIOCSIFHWBROADCAST'), (Constant('SIOCSIFLINK', 0x8911), 'SIOCSIFLINK'), (Constant('SIOCSIFMAP', 0x8971), 'SIOCSIFMAP'), (Constant('SIOCSIFMEM', 0x8920), 'SIOCSIFMEM'), (Constant('SIOCSIFMETRIC', 0x891e), 'SIOCSIFMETRIC'), (Constant('SIOCSIFMTU', 0x8922), 'SIOCSIFMTU'), (Constant('SIOCSIFNAME', 0x8923), 'SIOCSIFNAME'), (Constant('SIOCSIFNETMASK', 0x891c), 'SIOCSIFNETMASK'), (Constant('SIOCSIFPFLAGS', 0x8934), 'SIOCSIFPFLAGS'), (Constant('SIOCSIFSLAVE', 0x8930), 'SIOCSIFSLAVE'), (Constant('SIOCSIFTXQLEN', 0x8943), 'SIOCSIFTXQLEN'), (Constant('SIOCSRARP', 0x8962), 'SIOCSRARP'), (Constant('SOCK_DCCP', 0x6), 'SOCK_DCCP'), (Constant('SOCK_DGRAM', 0x2), 'SOCK_DGRAM'), (Constant('SOCK_PACKET', 0xa), 'SOCK_PACKET'), (Constant('SOCK_RAW', 0x3), 'SOCK_RAW'), (Constant('SOCK_RDM', 0x4), 'SOCK_RDM'), (Constant('SOCK_SEQPACKET', 0x5), 'SOCK_SEQPACKET'), (Constant('SOCK_STREAM', 0x1), 'SOCK_STREAM'), (Constant('SOL_CAIF', 0x116), 'SOL_CAIF'), (Constant('SOL_DCCP', 0x10d), 'SOL_DCCP'), (Constant('SOL_DECNET', 0x105), 'SOL_DECNET'), (Constant('SOL_ICMPV6', 0x3a), 'SOL_ICMPV6'), (Constant('SOL_IUCV', 0x115), 'SOL_IUCV'), (Constant('SOL_KCM', 0x119), 'SOL_KCM'), (Constant('SOL_LLC', 0x10c), 'SOL_LLC'), (Constant('SOL_NFC', 0x118), 'SOL_NFC'), (Constant('SOL_PACKET', 0x107), 'SOL_PACKET'), (Constant('SOL_RXRPC', 0x110), 'SOL_RXRPC'), (Constant('SOL_SCTP', 0x84), 'SOL_SCTP'), (Constant('SOL_SOCKET', 0x1), 'SOL_SOCKET'), (Constant('SOL_TCP', 0x6), 'SOL_TCP'), (Constant('SOL_TIPC', 0x10f), 'SOL_TIPC'), (Constant('SOMAXCONN', 0x80), 'SOMAXCONN'), (Constant('SO_ACCEPTCONN', 0x1e), 'SO_ACCEPTCONN'), (Constant('SO_ATTACH_BPF', 0x32), 'SO_ATTACH_BPF'), (Constant('SO_ATTACH_FILTER', 0x1a), 'SO_ATTACH_FILTER'), (Constant('SO_ATTACH_REUSEPORT_CBPF', 0x33), 'SO_ATTACH_REUSEPORT_CBPF'), (Constant('SO_ATTACH_REUSEPORT_EBPF', 0x34), 'SO_ATTACH_REUSEPORT_EBPF'), (Constant('SO_BINDTODEVICE', 0x19), 'SO_BINDTODEVICE'), (Constant('SO_BROADCAST', 0x6), 'SO_BROADCAST'), (Constant('SO_BSDCOMPAT', 0xe), 'SO_BSDCOMPAT'), (Constant('SO_CNX_ADVICE', 0x35), 'SO_CNX_ADVICE'), (Constant('SO_COOKIE', 0x39), 'SO_COOKIE'), (Constant('SO_DETACH_BPF', 0x1b), 'SO_DETACH_BPF'), (Constant('SO_DETACH_FILTER', 0x1b), 'SO_DETACH_FILTER'), (Constant('SO_INCOMING_CPU', 0x31), 'SO_INCOMING_CPU'), (Constant('SO_INCOMING_NAPI_ID', 0x38), 'SO_INCOMING_NAPI_ID'), (Constant('SO_LOCK_FILTER', 0x2c), 'SO_LOCK_FILTER'), (Constant('SO_MAX_PACING_RATE', 0x2f), 'SO_MAX_PACING_RATE'), (Constant('SO_NOFCS', 0x2b), 'SO_NOFCS'), (Constant('SO_NO_CHECK', 0xb), 'SO_NO_CHECK'), (Constant('SO_PASSCRED', 0x10), 'SO_PASSCRED'), (Constant('SO_PASSSEC', 0x22), 'SO_PASSSEC'), (Constant('SO_PEERCRED', 0x11), 'SO_PEERCRED'), (Constant('SO_PEERSEC', 0x1f), 'SO_PEERSEC'), (Constant('SO_PROTOCOL', 0x26), 'SO_PROTOCOL'), (Constant('SO_RCVBUF', 0x8), 'SO_RCVBUF'), (Constant('SO_RCVBUFFORCE', 0x21), 'SO_RCVBUFFORCE'), (Constant('SO_RCVLOWAT', 0x12), 'SO_RCVLOWAT'), (Constant('SO_RCVTIMEO', 0x14), 'SO_RCVTIMEO'), (Constant('SO_SECURITY_AUTHENTICATION', 0x16), 'SO_SECURITY_AUTHENTICATION'), (Constant('SO_SECURITY_ENCRYPTION_NETWORK', 0x18), 'SO_SECURITY_ENCRYPTION_NETWORK'), (Constant('SO_SECURITY_ENCRYPTION_TRANSPORT', 0x17), 'SO_SECURITY_ENCRYPTION_TRANSPORT'), (Constant('SO_SELECT_ERR_QUEUE', 0x2d), 'SO_SELECT_ERR_QUEUE'), (Constant('SO_SNDBUFFORCE', 0x20), 'SO_SNDBUFFORCE'), (Constant('SO_ZEROCOPY', 0x3c), 'SO_ZEROCOPY'), (Constant('SS_ONSTACK', 0x1), 'SS_ONSTACK'), (Constant('SYS_ACCEPT', 0x5), 'SYS_ACCEPT'), (Constant('SYS_CONNECT', 0x3), 'SYS_CONNECT'), (Constant('SYS_GETSOCKNAME', 0x6), 'SYS_GETSOCKNAME'), (Constant('SYS_GETSOCKOPT', 0xf), 'SYS_GETSOCKOPT'), (Constant('SYS_RECV', 0xa), 'SYS_RECV'), (Constant('SYS_RECVFROM', 0xc), 'SYS_RECVFROM'), (Constant('SYS_RECVMSG', 0x11), 'SYS_RECVMSG'), (Constant('SYS_SETSOCKOPT', 0xe), 'SYS_SETSOCKOPT'), (Constant('SYS_SOCKET', 0x1), 'SYS_SOCKET'), (Constant('SYS_SOCKETPAIR', 0x8), 'SYS_SOCKETPAIR'), (Constant('S_IEXEC', 0x40), 'S_IEXEC'), (Constant('S_IFCHR', 0x2000), 'S_IFCHR'), (Constant('S_IFSOCK', 0xc000), 'S_IFSOCK'), (Constant('X86_FXSR_MAGIC', 0x0), 'X86_FXSR_MAGIC'), (Constant('_CS_PATH', 0x1), '_CS_PATH'), (Constant('_PC_PATH_MAX', 0x1), '_PC_PATH_MAX'), (Constant('_PC_VDISABLE', 0x2), '_PC_VDISABLE'), (Constant('_SC_ARG_MAX', 0x2), '_SC_ARG_MAX'), (Constant('_SC_CLK_TCK', 0x1), '_SC_CLK_TCK'), (Constant('_SC_GETGR_R_SIZE_MAX', 0x9), '_SC_GETGR_R_SIZE_MAX'), (Constant('_SC_GETPW_R_SIZE_MAX', 0x8), '_SC_GETPW_R_SIZE_MAX'), (Constant('_SC_NGROUPS_MAX', 0x3), '_SC_NGROUPS_MAX'), (Constant('_SC_NPROCESSORS_CONF', 0x6), '_SC_NPROCESSORS_CONF'), (Constant('_SC_NPROCESSORS_ONLN', 0x6), '_SC_NPROCESSORS_ONLN'), (Constant('_SC_OPEN_MAX', 0x4), '_SC_OPEN_MAX'), (Constant('_SC_PAGESIZE', 0x5), '_SC_PAGESIZE'), (Constant('_SC_PHYS_PAGES', 0x7), '_SC_PHYS_PAGES'), (Constant('__UNALIGNED_MEMORY_ACCESS_OK', 0x1), '__UNALIGNED_MEMORY_ACCESS_OK')]
```
Here is the cause of the issue:
```
ipdb> out[25:27]
[(Constant('CS', 0xd), 'CS'), (<class 'pwnlib.constants.constant.Constant'>, 'Constant')]
ipdb> sorted(out[24:27])
*** TypeError: '<' not supported between instances of 'type' and 'Constant'
```

Resolving patch:
diff --git a/pwnlib/commandline/constgrep.py b/pwnlib/commandline/constgrep.py
--- a/pwnlib/commandline/constgrep.py
+++ b/pwnlib/commandline/constgrep.py
@@ -91,9 +91,13 @@ def main(args):
             if not matcher.search(k):
                 continue
 
+            # Check if the value has proper type
+            val = getattr(mod, k)
+            if not isinstance(val, pwnlib.constants.constant.Constant):
+                continue
+
             # Check the constant
             if constant is not None:
-                val = getattr(mod, k)
                 if args.mask_mode:
                     if constant & val != val:
                         continue
@@ -102,7 +106,7 @@ def main(args):
                         continue
 
             # Append it
-            out.append((getattr(mod, k), k))
+            out.append((val, k))
             maxlen = max(len(k), maxlen)
 
         # Output all matching constants


Test patch: