Misc.py 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/usr/bin/env python3
  2. #
  3. # mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
  4. # Copyright (C)2013-2022 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen https://github.com/mmgen/mmgen-node-tools
  9. # https://gitlab.com/mmgen/mmgen https://gitlab.com/mmgen/mmgen-node-tools
  10. """
  11. mmgen_node_tools.Misc: miscellaneous data and functions for the MMGen Node Tools suite
  12. """
  13. curl_exit_codes = {
  14. 1: 'Unsupported protocol. This build of curl has no support for this protocol',
  15. 2: 'Failed to initialize',
  16. 3: 'URL malformed. The syntax was not correct',
  17. 4: 'A feature or option that was needed to perform the desired request was not enabled or was explicitly disabled at build-time. To make curl able to do this, you probably need another build of libcurl!',
  18. 5: 'Couldn’t resolve proxy. The given proxy host could not be resolved',
  19. 6: 'Couldn’t resolve host. The given remote host was not resolved',
  20. 7: 'Failed to connect to host',
  21. 8: 'Weird server reply. The server sent data curl couldn’t parse',
  22. 9: 'FTP access denied. The server denied login or denied access to the particular resource or directory you wanted to reach. Most often you tried to change to a directory that doesn’t exist on the server',
  23. 10: 'FTP accept failed. While waiting for the server to connect back when an active FTP session is used, an error code was sent over the control connection or similar',
  24. 11: 'FTP weird PASS reply. Curl couldn’t parse the reply sent to the PASS request',
  25. 12: 'During an active FTP session while waiting for the server to connect back to curl, the timeout expired',
  26. 13: 'FTP weird PASV reply, Curl couldn’t parse the reply sent to the PASV request',
  27. 14: 'FTP weird 227 format. Curl couldn’t parse the 227-line the server sent',
  28. 15: 'FTP can’t get host. Couldn’t resolve the host IP we got in the 227-line',
  29. 16: 'HTTP/2 error. A problem was detected in the HTTP2 framing layer. This is somewhat generic and can be one out of several problems, see the error message for details',
  30. 17: 'FTP couldn’t set binary. Couldn’t change transfer method to binary',
  31. 18: 'Partial file. Only a part of the file was transferred',
  32. 19: 'FTP couldn’t download/access the given file, the RETR (or similar) command failed',
  33. 21: 'FTP quote error. A quote command returned error from the server',
  34. 22: 'HTTP page not retrieved. The requested url was not found or returned another error with the HTTP error code being 400 or above. This return code only appears if -f, --fail is used',
  35. 23: 'Write error. Curl couldn’t write data to a local filesystem or similar',
  36. 25: 'FTP couldn’t STOR file. The server denied the STOR operation, used for FTP uploading',
  37. 26: 'Read error. Various reading problems',
  38. 27: 'Out of memory. A memory allocation request failed',
  39. 28: 'Operation timeout. The specified time-out period was reached according to the conditions',
  40. 30: 'FTP PORT failed. The PORT command failed. Not all FTP servers support the PORT command, try doing a transfer using PASV instead!',
  41. 31: 'FTP couldn’t use REST. The REST command failed. This command is used for resumed FTP transfers',
  42. 33: 'HTTP range error. The range "command" didn’t work',
  43. 34: 'HTTP post error. Internal post-request generation error',
  44. 35: 'SSL connect error. The SSL handshaking failed',
  45. 36: 'Bad download resume. Couldn’t continue an earlier aborted download',
  46. 37: 'FILE couldn’t read file. Failed to open the file. Permissions?',
  47. 38: 'LDAP cannot bind. LDAP bind operation failed',
  48. 39: 'LDAP search failed',
  49. 41: 'Function not found. A required LDAP function was not found',
  50. 42: 'Aborted by callback. An application told curl to abort the operation',
  51. 43: 'Internal error. A function was called with a bad parameter',
  52. 45: 'Interface error. A specified outgoing interface could not be used',
  53. 47: 'Too many redirects. When following redirects, curl hit the maximum amount',
  54. 48: 'Unknown option specified to libcurl. This indicates that you passed a weird option to curl that was passed on to libcurl and rejected. Read up in the manual!',
  55. 49: 'Malformed telnet option',
  56. 51: 'The peer’s SSL certificate or SSH MD5 fingerprint was not OK',
  57. 52: 'The server didn’t reply anything, which here is considered an error',
  58. 53: 'SSL crypto engine not found',
  59. 54: 'Cannot set SSL crypto engine as default',
  60. 55: 'Failed sending network data',
  61. 56: 'Failure in receiving network data',
  62. 58: 'Problem with the local certificate',
  63. 59: 'Couldn’t use specified SSL cipher',
  64. 60: 'Peer certificate cannot be authenticated with known CA certificates',
  65. 61: 'Unrecognized transfer encoding',
  66. 62: 'Invalid LDAP URL',
  67. 63: 'Maximum file size exceeded',
  68. 64: 'Requested FTP SSL level failed',
  69. 65: 'Sending the data requires a rewind that failed',
  70. 66: 'Failed to initialise SSL Engine',
  71. 67: 'The user name, password, or similar was not accepted and curl failed to log in',
  72. 68: 'File not found on TFTP server',
  73. 69: 'Permission problem on TFTP server',
  74. 70: 'Out of disk space on TFTP server',
  75. 71: 'Illegal TFTP operation',
  76. 72: 'Unknown TFTP transfer ID',
  77. 73: 'File already exists (TFTP)',
  78. 74: 'No such user (TFTP)',
  79. 75: 'Character conversion failed',
  80. 76: 'Character conversion functions required',
  81. 77: 'Problem with reading the SSL CA cert (path? access rights?)',
  82. 78: 'The resource referenced in the URL does not exist',
  83. 79: 'An unspecified error occurred during the SSH session',
  84. 80: 'Failed to shut down the SSL connection',
  85. 82: 'Could not load CRL file, missing or wrong format (added in 7.19.0)',
  86. 83: 'Issuer check failed (added in 7.19.0)',
  87. 84: 'The FTP PRET command failed',
  88. 85: 'RTSP: mismatch of CSeq numbers',
  89. 86: 'RTSP: mismatch of Session Identifiers',
  90. 87: 'unable to parse FTP file list',
  91. 88: 'FTP chunk callback reported error',
  92. 89: 'No connection available, the session will be queued',
  93. 90: 'SSL public key does not matched pinned public key',
  94. 91: 'Invalid SSL certificate status',
  95. 92: 'Stream error in HTTP/2 framing layer',
  96. 93: 'An API function was called from inside a callback',
  97. 94: 'An authentication function returned an error',
  98. 95: 'A problem was detected in the HTTP/3 layer. This is somewhat generic and can be one out of several problems, see the error message for details',
  99. 96: 'QUIC connection error. This error may be caused by an SSL library error. QUIC is the protocol used for HTTP/3 transfers',
  100. }