Plugin Directory

Changeset 2837032


Ignore:
Timestamp:
12/21/2022 04:22:47 AM (2 years ago)
Author:
wtsec
Message:

2.4.17

  • Added the setting blocking countries
  • Added WP scan page: Log of user actions. Logs on found links, scripts and iframes
Location:
wt-security
Files:
448 added
1 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • wt-security/trunk/includes/css/main.css

    r2797028 r2837032  
    5252  margin-left: -18px;
    5353}
    54 .wtotem_body .lock {
     54.wtotem_body p{
     55  font-size: 14px;
     56}
     57.wtotem_body.lock, body.lock{
    5558  overflow: hidden;
    5659}
     
    48754878  display: block;
    48764879  position: fixed;
    4877   min-height: 100vh;
     4880  height: 100vh;
    48784881  overflow-y: auto;
    48794882  top: 30px;
     
    52185221
    52195222/*
     5223 * Country blocking styles
     5224*/
     5225.wtotem_body .block-country-section {
     5226  padding: 19px 17px;
     5227  display: flex;
     5228  align-items: center;
     5229}
     5230.wtotem_body .block-country-section__content{
     5231  width: 100%;
     5232}
     5233.wtotem_body .country-blocking-modal-attacks-container {
     5234  display: flex;
     5235  justify-content: space-between;
     5236  padding: 16px 12px;
     5237  border: 1px solid #f3f5f6;
     5238  border-radius: 10px;
     5239}
     5240.wtotem_body .country-blocking-modal .side-modal__content{
     5241  width: 650px!important;
     5242}
     5243.wtotem_body .country-blocking-modal-attack-block {
     5244  display: flex;
     5245  flex-direction: column;
     5246  /*color: #5e6977;*/
     5247  gap: 10px;
     5248  margin-right: 10px;
     5249}
     5250.wtotem_body .country-blocking-modal-attack-block__percent {
     5251  font-size: 20px;
     5252  font-weight: 700;
     5253}
     5254.wtotem_body .country-blocking-modal-attack-block__country {
     5255  font-weight: 500;
     5256  font-size: 14px;
     5257}
     5258.wtotem_body .country-blocking-modal-attack-block__country span {
     5259  color: #3d50df;
     5260}
     5261.wtotem_body .country-blocking-modal-header {
     5262  padding: 30px;
     5263  box-shadow: 0px 20px 20px -20px rgba(0, 0, 0, 0.15);
     5264  display: flex;
     5265  flex-direction: column;
     5266  gap: 20px;
     5267}
     5268.wtotem_body .country-blocking-modal__search-input {
     5269  padding: 3px 15px;
     5270  border: 2px solid #f3f5f6;
     5271  border-radius: 10px;
     5272  width: 100%;
     5273  font-weight: 500;
     5274  font-size: 16px;
     5275}
     5276.wtotem_body .country-blocking-modal__search-input::placeholder {
     5277  color: #86939e;
     5278  font-weight: 500;
     5279  font-size: 16px;
     5280}
     5281.wtotem_body .country-blocking-modal__content {
     5282  height: calc(100% - 100px);
     5283}
     5284.wtotem_body .country-blocking-form {
     5285  color: #9dafbd;
     5286  font-size: 14px;
     5287  min-height: calc(100% - 210px);
     5288  display: flex;
     5289  flex-direction: column;
     5290  justify-content: space-between;
     5291}
     5292.wtotem_body .country-blocking-form__main {
     5293  padding-bottom: 95px;
     5294}
     5295.wtotem_body .country-blocking-form__select-all {
     5296  display: flex;
     5297  align-items: center;
     5298  gap: 16px;
     5299  padding: 15px 30px 0;
     5300}
     5301.wtotem_body .country-blocking-form__checkbox:focus {
     5302  border-width: 1px;
     5303}
     5304.wtotem_body .country-blocking-form__region-container {
     5305  display: flex;
     5306  justify-content: space-between;
     5307  align-items: center;
     5308  padding: 15px 30px;
     5309  border-bottom: 1px solid #f3f5f6;
     5310  background-color: transparent;
     5311  border: none;
     5312  cursor: pointer;
     5313  width: 100%;
     5314  color: inherit;
     5315}
     5316.wtotem_body .country-blocking-form__select-region {
     5317  display: flex;
     5318  align-items: center;
     5319  justify-content: space-between;
     5320  border-bottom: 1px solid #f3f5f6;
     5321  padding: 15px 0;
     5322}
     5323.wtotem_body .country-blocking-form__region-name {
     5324  color: #86939e;
     5325  font-size: 18px;
     5326  font-weight: 500;
     5327  text-align: left;
     5328  margin-bottom: 4px;
     5329}
     5330.wtotem_body .country-blocking-form__country-container {
     5331  display: flex;
     5332  align-items: center;
     5333  justify-content: space-between;
     5334}
     5335.wtotem_body .country-blocking-form__region-countries {
     5336  height: 0;
     5337  overflow: hidden;
     5338}
     5339.wtotem_body .country-blocking-form__region-countries--open {
     5340  padding: 13px 50px;
     5341  height: auto;
     5342}
     5343.wtotem_body .country-blocking-form__country {
     5344  padding: 15px 0;
     5345  display: flex;
     5346  align-items: center;
     5347  gap: 12px;
     5348}
     5349.wtotem_body .country-blocking-form-save {
     5350  padding: 20px 45px;
     5351  display: flex;
     5352  justify-content: space-between;
     5353  align-items: center;
     5354  background-color: #fff;
     5355  box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.15);
     5356  position: sticky;
     5357  left: 0;
     5358  width: 100%;
     5359  bottom: 30px;
     5360}
     5361.wtotem_body .country-blocking-form-save__btn {
     5362  margin: 0!important;
     5363  text-transform: uppercase;
     5364  font-weight: bold;
     5365}
     5366.wtotem_body .chevron {
     5367  rotate: 0deg;
     5368  transition: all 0.1s ease-in;
     5369}
     5370.wtotem_body .chevron--open {
     5371  rotate: -90deg;
     5372}
     5373
     5374/*
     5375 * WP scan page styles
     5376*/
     5377.wtotem_scan__third {
     5378  margin-top: 48px;
     5379}
     5380::-webkit-scrollbar {
     5381  width: 4px;
     5382}
     5383::-webkit-scrollbar-thumb {
     5384  background-color: #d1d5db;
     5385  border-radius: 22222px;
     5386}
     5387.tab.audit-logs,
     5388.tab.links,
     5389.tab.scripts,
     5390.tab.iframes {
     5391  display: none;
     5392}
     5393.tab.audit-logs.tab--active,
     5394.tab.links.tab--active,
     5395.tab.scripts.tab--active,
     5396.tab.iframes.tab--active {
     5397  display: block;
     5398}
     5399.scan-tabs {
     5400  display: flex;
     5401  gap: 40px;
     5402  padding: 12px 0 0;
     5403  border-bottom: 1px solid #f3f4f6;
     5404  margin: 0 16px;
     5405}
     5406.scan-tabs__item {
     5407  padding-bottom: 16px;
     5408  border-bottom: 2px solid transparent;
     5409  transform: translateY(1.5px);
     5410}
     5411.scan-tabs__item .num {
     5412  padding: 2px 10px;
     5413  border-radius: 10px;
     5414  margin-left: 8px;
     5415  background-color: #f3f4f6;
     5416  color: #1d293f;
     5417}
     5418.scan-tabs__item .num--empty {
     5419  padding: 0;
     5420}
     5421.scan-tabs__item--active {
     5422  border-bottom-color: #3d50df;
     5423}
     5424.scan-tabs__item--active .scan-tabs__btn {
     5425  color: #3d50df;
     5426}
     5427.scan-tabs__item--active .num {
     5428  color: #3d50df;
     5429  background-color: #e0e7ff;
     5430}
     5431.scan-tabs__btn {
     5432  font-weight: 500;
     5433  cursor: pointer;
     5434  color: #86939e;
     5435  background-color: transparent;
     5436  border: none;
     5437}
     5438.audit-logs {
     5439  display: flex;
     5440  flex-direction: column;
     5441}
     5442.audit-logs__controls {
     5443  display: flex;
     5444  padding: 12px 16px;
     5445  border-bottom: 1px solid #f3f4f6;
     5446}
     5447.audit-logs__time {
     5448  background-color: transparent;
     5449  border: none;
     5450  color: #86939e;
     5451  text-transform: uppercase;
     5452  display: flex;
     5453  gap: 35px;
     5454  align-items: center;
     5455  padding-right: 15px
     5456}
     5457.audit-logs__time:hover {
     5458  cursor: pointer;
     5459}
     5460.audit-logs__time-icon--up,
     5461.audit-logs__time-icon--down {
     5462  width: 8px;
     5463  fill: #86939e;
     5464}
     5465.audit-logs__time[data-order="descending"] .audit-logs__time-icon--down {
     5466  fill: #1d293f;
     5467}
     5468.audit-logs__time[data-order="ascending"] .audit-logs__time-icon--up {
     5469  fill: #1d293f;
     5470}
     5471.audit-logs__icon-container {
     5472  height: 24px;
     5473  display: flex;
     5474  gap: 4px;
     5475  justify-content: center;
     5476  flex-direction: column;
     5477}
     5478.audit-logs__label {
     5479  color: #86939e;
     5480  text-transform: uppercase;
     5481}
     5482.audit-logs__event-container {
     5483  display: flex;
     5484  align-items: center;
     5485  gap: 24px;
     5486  flex: 3;
     5487}
     5488.audit-logs__event {
     5489  padding: 5px 8px;
     5490  border-radius: 6px;
     5491  border: 1px solid #d1d5db;
     5492  color: #86939e;
     5493}
     5494.audit-logs__left {
     5495  display: flex;
     5496  justify-content: space-between;
     5497  align-items: center;
     5498  flex: 2;
     5499}
     5500.audit-logs__ip {
     5501  text-align: right;
     5502  flex: 1;
     5503}
     5504.audit-logs__time,
     5505.audit-logs__user {
     5506  flex: 1;
     5507}
     5508.audit-logs__user {
     5509  padding-right: 20px;
     5510}
     5511.audit-logs__content {
     5512  display: flex;
     5513  flex-direction: column;
     5514  gap: 32px;
     5515  /*max-height: 390px;*/
     5516  overflow-y: scroll;
     5517  padding: 12px 16px 20px;
     5518}
     5519.audit-logs__short-info {
     5520  display: flex;
     5521  align-items: center;
     5522}
     5523.audit-logs__date {
     5524  color: #1d293f;
     5525  font-size: 18px;
     5526  margin-right: 12px;
     5527}
     5528.audit-logs__divider {
     5529  flex: 5;
     5530  background-color: #d1d5db;
     5531  height: 1px;
     5532  float: left;
     5533  align-items: center;
     5534}
     5535.audit-logs__time-count {
     5536  text-align: right;
     5537  display: flex;
     5538  align-items: center;
     5539  justify-content: center;
     5540  width: 35px;
     5541  height: 35px;
     5542  border: 1px solid #d1d5db;
     5543  border-radius: 100%;
     5544}
     5545.audit-logs__entries-container {
     5546  display: flex;
     5547  flex-direction: column;
     5548  gap: 20px;
     5549}
     5550.audit-logs-entry {
     5551  display: flex;
     5552  justify-content: space-between;
     5553}
     5554.audit-logs-entry__left {
     5555  display: flex;
     5556  justify-content: space-between;
     5557  align-items: center;
     5558  flex: 2;
     5559}
     5560.audit-logs-entry__ip {
     5561  flex: 1;
     5562  text-align: right;
     5563  color: #86939e;
     5564  font-size: 14px;
     5565}
     5566.audit-logs-entry__time {
     5567  color: #86939e;
     5568  display: flex;
     5569  align-items: center;
     5570  gap: 4px;
     5571  flex: 1;
     5572  margin-right: -25px;
     5573}
     5574.audit-logs-entry__description {
     5575  flex: 3;
     5576  color: #1d293f;
     5577  max-width: 395px;
     5578  word-break: break-all;
     5579}
     5580.audit-logs-entry__status-container {
     5581  flex: 1;
     5582  margin-right: 25px;
     5583  width: 131px;
     5584  position: relative;
     5585  align-items: center;
     5586  display: flex;
     5587}
     5588.audit-logs-entry__status{
     5589  padding: 0 10px;
     5590  border-radius: 10px;
     5591  max-width: 130px;
     5592  width: fit-content;
     5593  text-overflow:ellipsis;
     5594  white-space: nowrap;
     5595  overflow: hidden;
     5596  display: block;
     5597  position: absolute;
     5598}
     5599.audit-logs-entry__status:hover{
     5600  text-overflow:clip;
     5601  width:auto;
     5602  white-space: normal;
     5603  max-width: none;
     5604}
     5605.audit-logs-entry__status--notice {
     5606  color: #065f46;
     5607  background-color: #d1fae5;
     5608}
     5609.audit-logs-entry__status--warning {
     5610  color: #92400e;
     5611  background-color: #fef3c7;
     5612}
     5613.audit-logs-entry__status--critical {
     5614  color: #991b1b;
     5615  background-color: #fee2e2;
     5616}
     5617.audit-logs-entry[data-unseen="1"] .audit-logs-entry__new {
     5618  display: block;
     5619  width: 6px;
     5620  height: 6px;
     5621  background-color: #3d50df;
     5622  border-radius: 100%;
     5623}
     5624.tab.links.tab--active,
     5625.tab.scripts.tab--active,
     5626.tab.iframes.tab--active {
     5627  display: flex;
     5628  flex-direction: column;
     5629  gap: 20px;
     5630  /*height: 390px;*/
     5631  margin-top: 12px;
     5632  overflow-y: scroll;
     5633}
     5634.tab.links.tab--active.tab--no-data,
     5635.tab.scripts.tab--active.tab--no-data,
     5636.tab.iframes.tab--active.tab--no-data {
     5637  justify-content: center;
     5638  align-items: center;
     5639  color: #1d293f;
     5640}
     5641.tab.links.tab--active .links__item,
     5642.tab.links.tab--active .scripts__item,
     5643.tab.links.tab--active .iframes__item,
     5644.tab.scripts.tab--active .links__item,
     5645.tab.scripts.tab--active .scripts__item,
     5646.tab.scripts.tab--active .iframes__item,
     5647.tab.iframes.tab--active .links__item,
     5648.tab.iframes.tab--active .scripts__item,
     5649.tab.iframes.tab--active .iframes__item {
     5650  color: #3d50df;
     5651  padding: 8px 16px;
     5652  display: flex;
     5653  align-items: center;
     5654  gap: 13px;
     5655}
     5656
     5657.wtotem_body .span__item{
     5658  padding: 8px 16px;
     5659  display: flex;
     5660  align-items: center;
     5661  gap: 13px;
     5662}
     5663
     5664.tab.links.tab--active .links__item .hover-icon,
     5665.tab.links.tab--active .scripts__item .hover-icon,
     5666.tab.links.tab--active .iframes__item .hover-icon,
     5667.tab.scripts.tab--active .links__item .hover-icon,
     5668.tab.scripts.tab--active .scripts__item .hover-icon,
     5669.tab.scripts.tab--active .iframes__item .hover-icon,
     5670.tab.iframes.tab--active .links__item .hover-icon,
     5671.tab.iframes.tab--active .scripts__item .hover-icon,
     5672.tab.iframes.tab--active .iframes__item .hover-icon {
     5673  display: none;
     5674}
     5675.tab.links.tab--active .links__item:hover,
     5676.tab.links.tab--active .scripts__item:hover,
     5677.tab.links.tab--active .iframes__item:hover,
     5678.tab.scripts.tab--active .links__item:hover,
     5679.tab.scripts.tab--active .scripts__item:hover,
     5680.tab.scripts.tab--active .iframes__item:hover,
     5681.tab.iframes.tab--active .links__item:hover,
     5682.tab.iframes.tab--active .scripts__item:hover,
     5683.tab.iframes.tab--active .iframes__item:hover {
     5684  background-color: rgba(61, 80, 223, 0.04);
     5685}
     5686.tab.links.tab--active .links__item:hover .hover-icon,
     5687.tab.links.tab--active .scripts__item:hover .hover-icon,
     5688.tab.links.tab--active .iframes__item:hover .hover-icon,
     5689.tab.scripts.tab--active .links__item:hover .hover-icon,
     5690.tab.scripts.tab--active .scripts__item:hover .hover-icon,
     5691.tab.scripts.tab--active .iframes__item:hover .hover-icon,
     5692.tab.iframes.tab--active .links__item:hover .hover-icon,
     5693.tab.iframes.tab--active .scripts__item:hover .hover-icon,
     5694.tab.iframes.tab--active .iframes__item:hover .hover-icon {
     5695  display: block;
     5696}
     5697.files__controls {
     5698  display: flex;
     5699  gap: 36px;
     5700  border-bottom: 1px solid #f3f5f6;
     5701  padding: 12px 16px;
     5702}
     5703.files__controls[data-order-type="date"] .files__btn--last-modify[data-order="descending"] .files__last-modify-icon--down {
     5704  fill: #1d293f;
     5705}
     5706.files__controls[data-order-type="date"] .files__btn--last-modify[data-order="ascending"] .files__last-modify-icon--up {
     5707  fill: #1d293f;
     5708}
     5709.files__controls[data-order-type="size"] .files__btn--size[data-order="descending"] .files__size-icon--down {
     5710  fill: #1d293f;
     5711}
     5712.files__controls[data-order-type="size"] .files__btn--size[data-order="ascending"] .files__size-icon--up {
     5713  fill: #1d293f;
     5714}
     5715.files__btn {
     5716  background-color: transparent;
     5717  border: none;
     5718  display: flex;
     5719  justify-content: space-between;
     5720  align-items: center;
     5721  color: #86939e;
     5722  text-transform: uppercase;
     5723}
     5724.files__btn:hover {
     5725  cursor: pointer;
     5726}
     5727.files__btn--size {
     5728  flex: 1;
     5729}
     5730.files__btn--last-modify {
     5731  flex: 2;
     5732}
     5733.files__btn--file-name {
     5734  flex: 3;
     5735}
     5736.files__icon-container {
     5737  height: 24px;
     5738  display: flex;
     5739  gap: 4px;
     5740  justify-content: center;
     5741  flex-direction: column;
     5742}
     5743.files__icon {
     5744  width: 8px;
     5745  fill: #86939e;
     5746}
     5747.files__file-name-title {
     5748  color: #86939e;
     5749  text-transform: uppercase;
     5750  flex: 3;
     5751}
     5752.files__path {
     5753  color: #86939e;
     5754  text-transform: uppercase;
     5755  flex: 4;
     5756}
     5757.files__empty {
     5758  flex: 1;
     5759}
     5760.files__icon-container {
     5761  display: flex;
     5762  flex-direction: column;
     5763}
     5764.files__container {
     5765  display: flex;
     5766  flex-direction: column;
     5767  gap: 16px;
     5768  max-height: 390px;
     5769  overflow-y: scroll;
     5770}
     5771.files__item {
     5772  display: flex;
     5773  gap: 36px;
     5774  align-items: flex-start;
     5775  padding: 8px 12px 16px;
     5776  font-size: 14px;
     5777}
     5778.files__item:hover {
     5779  background-color: rgba(61, 80, 223, 0.04);
     5780}
     5781.files__size {
     5782  flex: 1;
     5783  color: #86939e;
     5784  text-transform: uppercase;
     5785}
     5786.files__last-modify {
     5787  flex: 2;
     5788  color: #1d293f;
     5789}
     5790.files__file-name {
     5791  flex: 3;
     5792  color: #3d50df;
     5793}
     5794.files__file-name:focus-visible {
     5795  text-decoration: underline;
     5796}
     5797.files__file-path {
     5798  flex: 4;
     5799  word-break: break-all;
     5800  color: #1d293f;
     5801  line-height: 20px;
     5802}
     5803.files__btn-dots {
     5804  display: flex;
     5805  justify-content: end;
     5806  background-color: transparent;
     5807  border: 1px solid transparent;
     5808  flex: 1;
     5809  margin-top: 5px;
     5810  position: relative;
     5811}
     5812.files__btn-dots:hover {
     5813  cursor: pointer;
     5814}
     5815.options {
     5816  flex-direction: column;
     5817  border-radius: 4px;
     5818  background-color: #fff;
     5819  box-shadow: 0px 4px 16px rgba(83, 93, 184, 0.12);
     5820  position: absolute;
     5821  display: none;
     5822}
     5823.options.options--open {
     5824  display: flex;
     5825}
     5826.options__item {
     5827  background-color: transparent;
     5828  border: none;
     5829  cursor: pointer;
     5830  color: #1d293f;
     5831  font-size: 14px;
     5832  padding: 11px 45px 11px 14px;
     5833  text-align: left;
     5834  display: flex;
     5835  gap: 10px;
     5836  align-items: flex-end;
     5837}
     5838.options__item:disabled {
     5839  color: #86939e;
     5840  cursor: default;
     5841}
     5842.options__item:not(:last-child) {
     5843  border-bottom: 1px solid #f3f5f6;
     5844}
     5845.popup {
     5846  position: fixed;
     5847  z-index: 10;
     5848  top: 0;
     5849  left: 0;
     5850  height: 100%;
     5851  width: 100%;
     5852  background: rgba(3, 4, 28, 0.3);
     5853  justify-content: center;
     5854  align-items: center;
     5855  font-family: "Inter", sans-serif;
     5856  display: none;
     5857}
     5858.popup--active {
     5859  display: flex;
     5860}
     5861.popup__container {
     5862  background-color: #fff;
     5863  border-radius: 8px;
     5864  padding: 24px;
     5865  display: flex;
     5866  flex-direction: column;
     5867  width: 512px;
     5868  box-shadow: 0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04);
     5869}
     5870.popup__content {
     5871  display: flex;
     5872  gap: 16px;
     5873}
     5874.popup__text {
     5875  display: flex;
     5876  flex-direction: column;
     5877  gap: 8px;
     5878}
     5879.popup__title {
     5880  color: #1d293f;
     5881  font-size: 18px;
     5882}
     5883.popup__file-name {
     5884  color: #86939e;
     5885  font-size: 14px;
     5886  word-break: break-all;
     5887  line-height: 20px;
     5888}
     5889.popup__btns {
     5890  margin-left: auto;
     5891  display: flex;
     5892  gap: 12px;
     5893}
     5894.popup__btn {
     5895  padding: 9px 17px;
     5896  border-radius: 6px;
     5897  font-size: 14px;
     5898  border: 1px solid transparent;
     5899  font-family: "Inter", sans-serif;
     5900}
     5901.popup__btn:hover {
     5902  cursor: pointer;
     5903}
     5904.popup__cancel {
     5905  border-color: #86939e;
     5906  color: #1d293f;
     5907  background-color: #fff;
     5908}
     5909.popup__delete {
     5910  background-color: #dc2626;
     5911  border-color: #dc2626;
     5912  color: #fff;
     5913}
     5914
     5915/*
     5916 * Pagination styles
     5917*/
     5918.wtotem_pagination {
     5919  display: flex;
     5920  align-items: center;
     5921  justify-content: center;
     5922  padding: 12px 16px 45px;
     5923}
     5924.wtotem_pagination__number {
     5925  color: #99a6b1;
     5926  font-weight: 500;
     5927  margin: 15px;
     5928  display: flex;
     5929  align-items: center;
     5930}
     5931.wtotem_pagination__number:hover {
     5932  color: #5e6977;
     5933}
     5934.wtotem_pagination__number_active {
     5935  width: 46px;
     5936  height: 46px;
     5937  background: #f1f3f5;
     5938  color: #5e6977;
     5939  margin: 0px;
     5940  border-radius: 100px;
     5941  display: flex;
     5942  justify-content: center;
     5943  align-items: center;
     5944}
     5945.wtotem_pagination__number_etc {
     5946  margin-right: 22px;
     5947}
     5948.wtotem_pagination__arrow {
     5949  width: 19px;
     5950  height: 12px;
     5951  display: block;
     5952  cursor: pointer;
     5953}
     5954
     5955/*
    52205956 * MultiSite page
    52215957*/
     
    54156151.wtotem_theme—dark .wtotem_body .wt_card,
    54166152.wtotem_theme—dark .wtotem_body .wt_card:before,
    5417 .wtotem_theme—dark .wtotem_chart-first__btn_active {
     6153.wtotem_theme—dark .wtotem_chart-first__btn_active,
     6154.wtotem_theme—dark .country-blocking-form-save{
    54186155  background: #282828;
    54196156}
     
    54726209.wtotem_theme—dark .wtotem_body .onoff__label:before,
    54736210.wtotem_theme—dark .wtotem_unit__expectation_loading,
    5474 .wtotem_theme—dark .wtotem_alert__text {
     6211.wtotem_theme—dark .wtotem_alert__text,
     6212.wtotem_theme—dark .audit-logs-entry__description,
     6213.wtotem_theme—dark .audit-logs__date{
    54756214  color: #f3f5f6;
    54766215}
     
    54876226.wtotem_theme—dark .wtotem_last_scan_av {
    54886227  border-color: #191919;
     6228}
     6229.wtotem_theme—dark .audit-logs__time-count{
     6230  border: 1px solid #3c3c3d;
    54896231}
    54906232.wtotem_theme—dark .wtotem_title-info__info {
     
    55106252  border-right: none;
    55116253}
    5512 .wtotem_theme—dark .wtotem_chart__line {
     6254.wtotem_theme—dark .wtotem_chart__line,
     6255.wtotem_theme—dark .audit-logs__divider{
    55136256  background: #3c3c3d;
    55146257}
    55156258.wtotem_theme—dark .wtotem_table__th,
    5516 .wtotem_theme—dark .wtotem_table__td {
     6259.wtotem_theme—dark .wtotem_table__td,
     6260.wtotem_theme—dark .wtotem_body .country-blocking-form__select-region{
    55176261  border-bottom: 1px solid #3c3c3d;
     6262}
     6263.wtotem_theme—dark .wtotem_body .country-blocking-form{
     6264  color: #e2e2e2;
    55186265}
    55196266.wtotem_theme—dark .wtotem_table__link:after {
     
    55366283  background: #2d2e2e;
    55376284}
    5538 
    55396285.wtotem_theme—dark .wtotem_body td,
    55406286.wtotem_theme—dark .wtotem_body th {
     
    55426288  background: #282828;
    55436289}
    5544 
    55456290.wtotem_theme—dark .wtotem_footer__logo {
    55466291  background: url("../img/dr-logo-footer.svg") no-repeat center center/cover;
     
    55816326  color: #e2e2e2;
    55826327}
    5583 .wtotem_theme—dark .wtotem_body .wtotem-waf-settings-popup__input {
     6328.wtotem_theme—dark .wtotem_body .country-blocking-modal-attacks-container {
    55846329  border: 1px solid #333333;
    5585   background-color: #191919;
    55866330  color: #ffffff;
    55876331}
    5588 .wtotem_theme—dark .wtotem_body .firewall-configuration__ip-adress {
     6332.wtotem_theme—dark .wtotem_body .wtotem-waf-settings-popup__input,
     6333.wtotem_theme—dark .wtotem_body .firewall-configuration__ip-adress,
     6334.wtotem_theme—dark .wtotem_body .country-blocking-modal__search-input{
    55896335  border: 1px solid #333333;
    55906336  background-color: #191919;
     
    57936539  color: #fff;
    57946540}
    5795 
     6541.wtotem_theme—dark .scan-tabs__item--active .scan-tabs__btn{
     6542  color: #7d8dff;
     6543}
     6544.wtotem_theme—dark .scan-tabs__item--active{
     6545  border-bottom-color: #7d8dff;
     6546}
    57966547.wtotem_theme—dark .firewall-log-report__payload{
    57976548  color: #000;
     6549}
     6550.wtotem_theme—dark .wtotem_body .audit-logs__event{
     6551  background: #191919 url(data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E) no-repeat right 5px top 55%;
     6552  color: #f3f5f6;
     6553}
     6554.wtotem_theme—dark .scan-tabs__item .num{
     6555  background-color: #191919;
     6556  color: #f3f5f6;
     6557}
     6558.wtotem_theme—dark .wtotem_body .scan-tabs__item--active .num{
     6559  background-color: #191919;
     6560  color: #7d8dff;
     6561}
     6562.wtotem_theme—dark .wtotem_body .audit-logs__controls,
     6563.wtotem_theme—dark .wtotem_body .scan-tabs{
     6564  border-bottom: 1px solid #3c3c3d;
    57986565}
    57996566
  • wt-security/trunk/includes/js/main.js

    r2797028 r2837032  
    3030    if (e.target.className.includes('popup-overlay')) {
    3131      $('.popup-overlay').addClass('d-none');
     32      $('body').removeClass('lock');
    3233    }
    3334  }).on('click', '.firewall-configuration__multi-adding', function () {
     
    103104  const overlay = document.querySelector(".side-modal__overlay");
    104105  const message = document.querySelector(".wtotem_input__messages");
     106  const bodyEl = document.getElementsByTagName("body")[0];
    105107  const toggleClassName = "side-modal--opened";
     108  const toggleBody = "lock";
    106109
    107110  const showModal = () => {
    108111    modal.classList.add(toggleClassName);
     112    bodyEl.classList.add(toggleBody);
    109113  };
    110114
    111115  const closeModal = () => {
    112116    modal.classList.remove(toggleClassName);
     117    bodyEl.classList.remove(toggleBody);
    113118    if (form) {
    114119      form.reset();
     
    132137    addSideModal(modal, openButton, closeButton, form);
    133138    addSideModal(modal, openButton2, closeButton, form);
     139  }
     140})();
     141
     142(function () {
     143  const modal = document.querySelector(".country-blocking-modal");
     144  const openButton = document.querySelector("#block_countries_btn");
     145  const closeButton = document.querySelector(".country-blocking-modal__closeBtn");
     146
     147  if (modal) {
     148    addSideModal(modal, openButton, closeButton, false);
    134149  }
    135150})();
  • wt-security/trunk/includes/templates/layout.html.twig

    r2797028 r2837032  
    127127                            </a>
    128128                        </li>
     129
     130                        <li class="wtotem_nav__item">
     131                            <a href="{{ menu_url }}_wpscan" class="wtotem_nav__link {{ is_active.wpscan }}">
     132                                {{ 'WP scan'|trans }}
     133                            </a>
     134                        </li>
    129135                    </ul>
    130136                </nav>
  • wt-security/trunk/includes/templates/notifications.html.twig

    r2797028 r2837032  
    1616
    1717        <script>
    18             toastr["{{ notice.type_raw }}"]('{{ notice.text | raw }}');
     18            jQuery(document).ready(function ($) {
     19                toastr["{{ notice.type_raw }}"]('{{ notice.text | raw }}');
     20            });
    1921        </script>
    2022    </div>
  • wt-security/trunk/includes/templates/settings_form.html.twig

    r2797028 r2837032  
    153153                },
    154154                function (data) {
    155                     if(!data.success){
    156                         jQuery('#gdn').prop("checked", false);
    157                         jQuery('#dos').prop("checked", true);
    158                         jQuery('#login_attempt').prop("checked", true);
    159                         jQuery('#dos_limit').val(1000);
    160                         jQuery('#login_attempt_limit').val(20);
    161 
    162                         jQuery('#wtotem-attempt-limit').removeClass('visually-hidden');
    163                         jQuery('#wtotem-dos-limit').removeClass('visually-hidden');
     155                    if(data.errors){
     156                        $('.wtotem_error_waf_settings').remove();
     157                        $('#wtotem-waf-settings input').removeClass('wtotem_input_error');
     158                        $.each(data.errors, function(index, value){
     159
     160                            if(value){
     161                                $('#wtotem_' + index).append('<div class="is--status--error wtotem-mb-15 wtotem_error_waf_settings">'+ value +'</div>')
     162                                $('#' + index ).addClass('wtotem_input_error');
     163                            }
     164                        });
     165
     166                    } else {
     167                        $('.wtotem_error_waf_settings').remove();
     168                        $('#wtotem-waf-settings input').removeClass('wtotem_input_error');
    164169                    }
     170
     171
    165172                    jQuery('#wtotem-waf-settings').removeClass('wtotem_loader_spinner');
    166173                    jQuery('#wtotem_notifications').html(data.notifications);
     
    328335        jQuery('#dos').on('change', function (e) {
    329336            if(jQuery(this).is(':checked')){
    330                 jQuery('#wtotem-dos-limit').removeClass('visually-hidden');
     337                jQuery('#wtotem_dos_limit').removeClass('visually-hidden');
    331338            } else {
    332                 jQuery('#wtotem-dos-limit').addClass('visually-hidden');
     339                jQuery('#wtotem_dos_limit').addClass('visually-hidden');
    333340            }
    334341        });
     
    336343        jQuery('#login_attempt').on('change', function (e) {
    337344            if(jQuery(this).is(':checked')){
    338                 jQuery('#wtotem-attempt-limit').removeClass('visually-hidden');
     345                jQuery('#wtotem_login_attempt_limit').removeClass('visually-hidden');
    339346            } else {
    340                 jQuery('#wtotem-attempt-limit').addClass('visually-hidden');
     347                jQuery('#wtotem_login_attempt_limit').addClass('visually-hidden');
    341348            }
    342349        });
     
    383390            );
    384391        });
    385 
    386 
    387 
    388392    });
    389393</script>
     
    495499                </div>
    496500            </section>
     501
     502            <div class="wt_card wtotem-mb-20 block-country-section">
     503                <div class="block-country-section__content">
     504                    <h3 class="h3 wtotem-mb-15">{{ 'Country blocking'|trans }}</h3>
     505                    <p class="notifications-settings__text">{{ 'Block countries you want to limit access to your website.'|trans }}</p>
     506                </div>
     507                <button class="wtotem_control__btn wtotem_btn_wc" id="block_countries_btn" style="white-space: nowrap;">{{ 'Block countries'|trans }}</button>
     508
     509                {% include 'country_blocking_modal.html.twig' with {'blocked_countries_list': blocked_countries_list, 'mock_attacks': mock_attacks} %}
     510            </div>
    497511
    498512            <section class="wt_card wtotem-mb-20">
     
    906920                            </div>
    907921
    908                             <div id="wtotem-dos-limit" class="{{ waf_settings.dos.visually }}">
    909                                 <label class="wtotem-waf-settings-popup__label"
    910                                        for="dos_limit">{{ 'Login attempts' | trans }}</label>
     922                            <div id="wtotem_dos_limit" class="{{ waf_settings.dos.visually }}">
    911923                                <input class="wtotem-waf-settings-popup__input wtotem_settings_input" value="{{ waf_settings.dos_limit }}"
    912                                        type="number" min="0" id="dos_limit" name="dos_limit" required>
     924                                       type="number" min="500" max="100000" id="dos_limit" name="dos_limit" required>
    913925                            </div>
    914926
     
    936948                            </div>
    937949
    938                             <div id="wtotem-attempt-limit" class="{{ waf_settings.login_attempt.visually }}">
    939                                 <label class="wtotem-waf-settings-popup__label" for="login_attempt_limit">
    940                                     {{ 'Login attempts' | trans }}
    941                                 </label>
     950                            <div id="wtotem_login_attempt_limit" class="{{ waf_settings.login_attempt.visually }}">
     951                               
    942952                                <input class="wtotem-waf-settings-popup__input wtotem_settings_input" value="{{ waf_settings.login_attempt_limit }}"
    943                                        type="number" min="0" id="login_attempt_limit" name="login_attempt_limit" required>
     953                                       type="number" min="5" max="30" id="login_attempt_limit" name="login_attempt_limit" required>
    944954                            </div>
    945955
  • wt-security/trunk/lang/wtotem-ru_RU.po

    r2797028 r2837032  
    22msgstr ""
    33"Project-Id-Version: WebTotem Security\n"
    4 "POT-Creation-Date: 2022-09-20 15:43+0600\n"
     4"POT-Creation-Date: 2022-11-30 11:56+0600\n"
    55"PO-Revision-Date: \n"
    66"Last-Translator: wtsec <[email protected]>\n"
     
    1616"_nx_noop:1,2,3c;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
    1717"X-Poedit-Basepath: ..\n"
    18 "X-Generator: Poedit 3.1.1\n"
     18"X-Generator: Poedit 3.2\n"
    1919"X-Poedit-SearchPath-0: .\n"
    2020"X-Poedit-SearchPath-1: src\n"
     
    2323"X-Poedit-SearchPathExcluded-0: node_modules\n"
    2424
     25#: includes/js/country-blocking.js:443 src/Strings.php:292
     26msgid "countries blocked from"
     27msgstr "стран заблокировано в регионе"
     28
     29#: includes/js/country-blocking.js:457 src/Strings.php:293
     30msgid "Select all"
     31msgstr "Выбрать все"
     32
     33#: includes/js/country-blocking.js:562 src/Strings.php:97 src/Strings.php:291
     34msgid "Attack from"
     35msgstr "Атаки из"
     36
    2537#: includes/js/flatpickr.js:117
    2638msgid "Sunday"
     
    163175msgstr "Не удалось добавить сайт на платформу WebTotem ."
    164176
    165 #: lib/API.php:257
     177#: lib/API.php:262
    166178msgid "A new website has been added: "
    167179msgstr "Новый сайт был добавлен: "
     
    197209msgstr "API: пустое тело ответа ."
    198210
    199 #: lib/Ajax.php:171
     211#: lib/Ajax.php:170
    200212#, php-format
    201213msgid "Some scanning data for %s may be deleted."
    202214msgstr "Некоторые данные для %s могут быть удалены."
    203215
    204 #: lib/Ajax.php:182
     216#: lib/Ajax.php:181
    205217msgid "Are you sure you want to change the API key?"
    206218msgstr "Вы уверены, что хотите изменить ключ API?"
    207219
    208 #: lib/Ajax.php:842
     220#: lib/Ajax.php:943
    209221msgid "Report generation error"
    210222msgstr "Ошибка формирования отчета"
    211223
    212 #: lib/Ajax.php:872
     224#: lib/Ajax.php:973
    213225msgid "The report was successfully generated"
    214226msgstr "Отчет успешно сформирован"
    215227
    216 #: lib/Ajax.php:902 lib/Ajax.php:1233
     228#: lib/Ajax.php:1003 lib/Ajax.php:1384
    217229msgid ""
    218230"It is not possible to make changes because the agents are not installed."
    219231msgstr "Внести изменения невозможно, так как агенты не установлены."
    220232
    221 #: lib/Ajax.php:954 lib/Ajax.php:1013 lib/Ajax.php:1028 lib/Ajax.php:1053
    222 #: lib/Ajax.php:1125
     233#: lib/Ajax.php:1024 lib/Ajax.php:1036 lib/Ajax.php:1052 lib/Ajax.php:1106
     234#: lib/Ajax.php:1164 lib/Ajax.php:1179 lib/Ajax.php:1204 lib/Ajax.php:1276
     235#: lib/Ajax.php:1554
    223236msgid "Your changes have been applied successfully."
    224237msgstr "Ваши изменения были успешно применены."
    225238
    226 #: lib/Ajax.php:974 lib/Ajax.php:979 lib/Ajax.php:1074 lib/Ajax.php:1077
    227 #: lib/Ajax.php:1093 lib/Ajax.php:1096
     239#: lib/Ajax.php:1040
     240msgid "Your changes have not been applied."
     241msgstr "Ваши изменения не были применены."
     242
     243#: lib/Ajax.php:1068 lib/Ajax.php:1077 lib/Ajax.php:1125 lib/Ajax.php:1130
     244#: lib/Ajax.php:1225 lib/Ajax.php:1228 lib/Ajax.php:1244 lib/Ajax.php:1247
    228245msgid "The field is required."
    229246msgstr "Это поле обязательно для заполнения."
    230247
    231 #: lib/Ajax.php:976 lib/Ajax.php:981
     248#: lib/Ajax.php:1071 lib/Ajax.php:1080 lib/Ajax.php:1232 lib/Ajax.php:1251
     249#, php-format
     250msgid "Please specify a value from %s to %s."
     251msgstr "Пожалуйста укажите значение от %s до %s."
     252
     253#: lib/Ajax.php:1127 lib/Ajax.php:1132
    232254msgid "Invalid field length."
    233255msgstr "Недопустимая длина поля."
    234256
    235 #: lib/Ajax.php:991 lib/Ajax.php:992
     257#: lib/Ajax.php:1142 lib/Ajax.php:1143
    236258msgid "Make sure that you have filled in the field correctly."
    237259msgstr "Убедитесь, что вы правильно заполнили это поле."
    238260
    239 #: lib/Ajax.php:1014
     261#: lib/Ajax.php:1165
    240262msgid ""
    241263"Please make sure that no other recaptcha is used on your site. Otherwise, "
     
    247269"проблемы при входе в админ панель."
    248270
    249 #: lib/Ajax.php:1030
     271#: lib/Ajax.php:1181
    250272msgid ""
    251273"Please make sure that no other 2FA is used on your site. Otherwise, there "
     
    256278"который повлечет за собой проблемы при входе в админ панель."
    257279
    258 #: lib/Ajax.php:1081 lib/Ajax.php:1100
    259 msgid "Please specify a value from 1 to 1000000."
    260 msgstr "Пожалуйста укажите значение от 1 до 1000000."
    261 
    262 #: lib/Ajax.php:1327
     280#: lib/Ajax.php:1478
    263281msgid "You cannot delete the primary domain."
    264282msgstr "Основной домен не может быть удален."
    265283
    266 #: lib/Ajax.php:1617 lib/Ajax.php:1618 src/PageHandler.php:353
    267 #: src/PageHandler.php:354
     284#: lib/Ajax.php:1535
     285msgid "You cannot edit this user."
     286msgstr "Вы не можете редактировать этого пользователя."
     287
     288#: lib/Ajax.php:1557
     289msgid "You have entered an incorrect activation code."
     290msgstr "Вы ввели неверный код активации."
     291
     292#: lib/Ajax.php:1771 lib/Ajax.php:1772 src/PageHandler.php:354
     293#: src/PageHandler.php:355
    268294msgid "ms."
    269295msgstr "мс."
    270296
    271 #: lib/Ajax.php:1705
     297#: lib/Ajax.php:1859
    272298#, php-format
    273299msgid ""
     
    278304"href=\"%s\" title=\"Забыли пароль\">Забыли пароль</a>?"
    279305
    280 #: lib/Ajax.php:1729
     306#: lib/Ajax.php:1883
    281307#, php-format
    282308msgid ""
     
    13191345msgstr "Зимбабве"
    13201346
    1321 #: lib/Helper.php:156
     1347#: lib/Helper.php:174 lib/modules/logs/EventListener.php:23
     1348#: lib/modules/logs/EventListener.php:37 lib/modules/logs/EventListener.php:270
     1349#: lib/modules/logs/EventListener.php:299
     1350#: lib/modules/logs/EventListener.php:445
     1351#: lib/modules/logs/EventListener.php:546
     1352#: lib/modules/logs/EventListener.php:741
     1353#: lib/modules/logs/EventListener.php:776
     1354#: lib/modules/logs/EventListener.php:880
    13221355msgid "Unknown"
    13231356msgstr "Неизвестно"
    13241357
    1325 #: lib/Helper.php:264
     1358#: lib/Helper.php:282
    13261359msgid "Limit of adding sites exceeded."
    13271360msgstr "Превышен лимит добавления сайтов."
    13281361
    1329 #: lib/Helper.php:268
     1362#: lib/Helper.php:286
    13301363msgid "A user with this email already exists."
    13311364msgstr "Пользователь с таким email уще существует."
    13321365
    1333 #: lib/Helper.php:272
     1366#: lib/Helper.php:290
    13341367msgid "Duplicate host"
    13351368msgstr "Дублирование домена"
    13361369
    1337 #: lib/Helper.php:276
     1370#: lib/Helper.php:294
    13381371msgid "Invalid Domain Name"
    13391372msgstr "Неправильный формат домена"
    13401373
    1341 #: lib/Helper.php:381
     1374#: lib/Helper.php:399
    13421375msgid "Warning"
    13431376msgstr "Внимание"
    13441377
    1345 #: lib/Helper.php:382
     1378#: lib/Helper.php:400
    13461379msgid "Error"
    13471380msgstr "Ошибка"
    13481381
    1349 #: lib/Helper.php:383
     1382#: lib/Helper.php:401
    13501383msgid "Success"
    13511384msgstr "Успешно"
    13521385
    1353 #: lib/Helper.php:384
     1386#: lib/Helper.php:402
    13541387msgid "Info"
    13551388msgstr "Инфо"
    13561389
    1357 #: lib/Helper.php:385
     1390#: lib/Helper.php:403
    13581391msgid "Invalid"
    13591392msgstr "Недействительный"
    13601393
    1361 #: lib/Helper.php:386
     1394#: lib/Helper.php:404
    13621395msgid "Everything is OK"
    13631396msgstr "Все Ок"
    13641397
    1365 #: lib/Helper.php:387
     1398#: lib/Helper.php:405
    13661399msgid "Expired"
    13671400msgstr "Истек"
    13681401
    1369 #: lib/Helper.php:388
     1402#: lib/Helper.php:406
    13701403msgid "Expires"
    13711404msgstr "Истекает"
    13721405
    1373 #: lib/Helper.php:389
     1406#: lib/Helper.php:407
    13741407msgid "Expires today"
    13751408msgstr "Истекает сегодня"
    13761409
    1377 #: lib/Helper.php:390
     1410#: lib/Helper.php:408
    13781411msgid "Missing"
    13791412msgstr "Отсутствует"
    13801413
    1381 #: lib/Helper.php:391
     1414#: lib/Helper.php:409
    13821415msgid "Active"
    13831416msgstr "Активно"
    13841417
    1385 #: lib/Helper.php:392
     1418#: lib/Helper.php:410
    13861419msgid "Inactive"
    13871420msgstr "Отключен"
    13881421
    1389 #: lib/Helper.php:393 src/Strings.php:98
     1422#: lib/Helper.php:411 src/Strings.php:98
    13901423msgid "Pending"
    13911424msgstr "Проверяется"
    13921425
    1393 #: lib/Helper.php:394
     1426#: lib/Helper.php:412
    13941427msgid "Disabled"
    13951428msgstr "Отключен"
    13961429
    1397 #: lib/Helper.php:395
     1430#: lib/Helper.php:413
    13981431msgid "Available"
    13991432msgstr "Доступно"
    14001433
    1401 #: lib/Helper.php:396
     1434#: lib/Helper.php:414
    14021435msgid "Not supported"
    14031436msgstr "Не поддерживается"
    14041437
    1405 #: lib/Helper.php:397
     1438#: lib/Helper.php:415
    14061439msgid "Not registered"
    14071440msgstr "Не зарегистрирован"
    14081441
    1409 #: lib/Helper.php:398
     1442#: lib/Helper.php:416
    14101443msgid "Unsupported"
    14111444msgstr "Не поддерживается"
    14121445
    1413 #: lib/Helper.php:399
     1446#: lib/Helper.php:417
    14141447msgid "Clean"
    14151448msgstr "Чист"
    14161449
    1417 #: lib/Helper.php:400
     1450#: lib/Helper.php:418
    14181451msgid "Clear"
    14191452msgstr "Чист"
    14201453
    1421 #: lib/Helper.php:401 lib/Helper.php:402 lib/Helper.php:415
     1454#: lib/Helper.php:419 lib/Helper.php:420 lib/Helper.php:433
    14221455msgid "Infected"
    14231456msgstr "Инфицирован"
    14241457
    1425 #: lib/Helper.php:403 lib/Helper.php:703 src/Strings.php:220
     1458#: lib/Helper.php:421 lib/Helper.php:721 src/Strings.php:220
    14261459msgid "Deface"
    14271460msgstr "Дефейс"
    14281461
    1429 #: lib/Helper.php:404
     1462#: lib/Helper.php:422
    14301463msgid "Modified"
    14311464msgstr "Модифицирован"
    14321465
    1433 #: lib/Helper.php:405
     1466#: lib/Helper.php:423
    14341467msgid "Detected"
    14351468msgstr "Обнаружен"
    14361469
    1437 #: lib/Helper.php:406 src/Strings.php:150
     1470#: lib/Helper.php:424 src/Strings.php:150
    14381471msgid "Open ports"
    14391472msgstr "Открытые порты"
    14401473
    1441 #: lib/Helper.php:407 src/Strings.php:95 src/Strings.php:287
     1474#: lib/Helper.php:425 src/Strings.php:95 src/Strings.php:301
    14421475msgid "Blocked"
    14431476msgstr "Заблокирован"
    14441477
    1445 #: lib/Helper.php:408
     1478#: lib/Helper.php:426
    14461479msgid "Connected"
    14471480msgstr "Соединен"
    14481481
    1449 #: lib/Helper.php:409
     1482#: lib/Helper.php:427
    14501483msgid "Attacks detected"
    14511484msgstr "Обнаружена атака"
    14521485
    1453 #: lib/Helper.php:410
     1486#: lib/Helper.php:428
    14541487msgid "Signature found"
    14551488msgstr "Обнаружена сигнатура"
    14561489
    1457 #: lib/Helper.php:411
     1490#: lib/Helper.php:429
    14581491msgid "File changes"
    14591492msgstr "Изменения в файлах"
    14601493
    1461 #: lib/Helper.php:412
     1494#: lib/Helper.php:430
    14621495msgid "No cert"
    14631496msgstr "Нет сертификата"
    14641497
    1465 #: lib/Helper.php:413
     1498#: lib/Helper.php:431
    14661499msgid "Down"
    14671500msgstr "Не работает"
    14681501
    1469 #: lib/Helper.php:414
     1502#: lib/Helper.php:432
    14701503msgid "Up"
    14711504msgstr "Работает"
    14721505
    1473 #: lib/Helper.php:416
     1506#: lib/Helper.php:434
    14741507msgid "Need to install"
    14751508msgstr "Не установлен"
    14761509
    1477 #: lib/Helper.php:417
     1510#: lib/Helper.php:435
    14781511msgid "Agent not available"
    14791512msgstr "Агент недоступен"
    14801513
    1481 #: lib/Helper.php:418
     1514#: lib/Helper.php:436
    14821515msgid "Update error"
    14831516msgstr "Ошибка обновления"
    14841517
    1485 #: lib/Helper.php:419
     1518#: lib/Helper.php:437
    14861519msgid "Session Error"
    14871520msgstr "Ошибка сессии"
    14881521
    1489 #: lib/Helper.php:420
     1522#: lib/Helper.php:438
    14901523msgid "Internal Error"
    14911524msgstr "Внутренняя ошибка"
    14921525
    1493 #: lib/Helper.php:421 src/Strings.php:34
     1526#: lib/Helper.php:439 src/Strings.php:34
    14941527msgid "Installing"
    14951528msgstr "Идет установка"
    14961529
    1497 #: lib/Helper.php:422 src/Strings.php:33
     1530#: lib/Helper.php:440 src/Strings.php:33
    14981531msgid "Installed"
    14991532msgstr "Установлен"
    15001533
    1501 #: lib/Helper.php:423
     1534#: lib/Helper.php:441
    15021535msgid "Working"
    15031536msgstr "В работе"
    15041537
    1505 #: lib/Helper.php:424
     1538#: lib/Helper.php:442
    15061539msgid "Critical"
    15071540msgstr "Критический"
    15081541
    1509 #: lib/Helper.php:425
     1542#: lib/Helper.php:443
    15101543msgid "Deleted"
    15111544msgstr "Удален"
    15121545
    1513 #: lib/Helper.php:426
     1546#: lib/Helper.php:444
    15141547msgid "Changed"
    15151548msgstr "Изменен"
    15161549
    1517 #: lib/Helper.php:427
     1550#: lib/Helper.php:445
    15181551msgid "New"
    15191552msgstr "Новый"
    15201553
    1521 #: lib/Helper.php:428
     1554#: lib/Helper.php:446
    15221555msgid "Scanned"
    15231556msgstr "Сканирован"
    15241557
    1525 #: lib/Helper.php:429
     1558#: lib/Helper.php:447
    15261559msgid "In quarantine"
    15271560msgstr "В карантине"
    15281561
    1529 #: lib/Helper.php:446
     1562#: lib/Helper.php:464
    15301563msgid ""
    15311564"Invalid -The certificate is invalid. Please, make sure that relevant "
     
    15351568"соответствующие данные сертификата заполнены правильно."
    15361569
    1537 #: lib/Helper.php:447
     1570#: lib/Helper.php:465
    15381571msgid ""
    15391572"Expired - The certificate has expired. Connection is not secure. Please, "
     
    15431576"Пожалуйста, продлите его."
    15441577
    1545 #: lib/Helper.php:448
     1578#: lib/Helper.php:466
    15461579msgid "Expires - The certificate expires soon. Please, take actions."
    15471580msgstr ""
     
    15491582"Пожалуйста, примите меры."
    15501583
    1551 #: lib/Helper.php:449
     1584#: lib/Helper.php:467
    15521585msgid "Expires today - The certificate expires today. Please, take actions."
    15531586msgstr ""
     
    15551588"Пожалуйста, примите меры."
    15561589
    1557 #: lib/Helper.php:450
     1590#: lib/Helper.php:468
    15581591msgid ""
    15591592"Error - Something went wrong. Please, contact us, we'll fix the problem."
     
    15621595"проблему."
    15631596
    1564 #: lib/Helper.php:451
     1597#: lib/Helper.php:469
    15651598msgid "Pending - System processes your website. Data will be available soon."
    15661599msgstr ""
     
    15681601"ближайшее время."
    15691602
    1570 #: lib/Helper.php:452
     1603#: lib/Helper.php:470
    15711604msgid "Pause - The module is paused."
    15721605msgstr "Пауза - Модуль находится в режиме паузы."
    15731606
    1574 #: lib/Helper.php:453
     1607#: lib/Helper.php:471
    15751608msgid "Everything is OK - Nothing to worry about. Everything is alright."
    15761609msgstr "Все ОК - Не о чем беспокоиться. Все в порядке."
    15771610
    1578 #: lib/Helper.php:454
     1611#: lib/Helper.php:472
    15791612msgid "Deface - Website hacked. Please, contact us, we'll fix the problem."
    15801613msgstr ""
    15811614"Дефейс - Сайт взломан. Пожалуйста, свяжитесь с нами, мы решим эту проблему."
    15821615
    1583 #: lib/Helper.php:455
     1616#: lib/Helper.php:473
    15841617msgid ""
    15851618"Open ports - Open ports detected. Your website is vulnerable to attacks."
     
    15881621"атак."
    15891622
    1590 #: lib/Helper.php:456
     1623#: lib/Helper.php:474
    15911624msgid "Blocked - The module is blocked due to billing issues."
    15921625msgstr ""
    15931626"Заблокирован - Модуль заблокирован из-за проблем с выставлением счетов."
    15941627
    1595 #: lib/Helper.php:457
     1628#: lib/Helper.php:475
    15961629msgid ""
    15971630"No cert - You don't have SSL certificate. We recommend you to install it for "
     
    16011634"его по соображениям безопасности."
    16021635
    1603 #: lib/Helper.php:458
     1636#: lib/Helper.php:476
    16041637msgid "Down - The website is not available for visitors."
    16051638msgstr "Не работает - Сайт недоступен для посетителей."
    16061639
    1607 #: lib/Helper.php:459
     1640#: lib/Helper.php:477
    16081641msgid "Up - The website is available for visitors."
    16091642msgstr "Работает - Сайт доступен для посетителей."
    16101643
    1611 #: lib/Helper.php:460
     1644#: lib/Helper.php:478
    16121645msgid ""
    16131646"Infected - The website site is blacklisted and may have infected files. "
     
    16171650"файлы. Пожалуйста, проверьте антивирусный модуль."
    16181651
    1619 #: lib/Helper.php:461
     1652#: lib/Helper.php:479
    16201653msgid ""
    16211654"It means that the agent installation is in progress. Usually, it takes up to "
     
    16251658"одного часа."
    16261659
    1627 #: lib/Helper.php:462
     1660#: lib/Helper.php:480
    16281661msgid "We cannot locate the agent right now."
    16291662msgstr "Мы в данный момент не можем подключиться к агенту."
    16301663
    1631 #: lib/Helper.php:463
     1664#: lib/Helper.php:481
    16321665msgid ""
    16331666"It seems that your agent failed to update due to permissions restrictions."
     
    16361669"разрешений."
    16371670
    1638 #: lib/Helper.php:464
     1671#: lib/Helper.php:482
    16391672msgid ""
    16401673"This means that the agent did not create a secure session. Possible causes "
     
    16461679"производителей. Обратитесь в службу поддержки."
    16471680
    1648 #: lib/Helper.php:465
     1681#: lib/Helper.php:483
    16491682msgid ""
    16501683"It means that the server is overloaded or there might be some problems with "
     
    16581691"поддержкой."
    16591692
    1660 #: lib/Helper.php:466 lib/Helper.php:467
     1693#: lib/Helper.php:484 lib/Helper.php:485
    16611694msgid "Everything is alright."
    16621695msgstr "Все в порядке."
    16631696
    1664 #: lib/Helper.php:468
     1697#: lib/Helper.php:486
    16651698msgid "You need to install agent manager to activate antivirus and firewall."
    16661699msgstr ""
     
    16681701"брандмауэр."
    16691702
    1670 #: lib/Helper.php:699 src/Strings.php:178
     1703#: lib/Helper.php:717 src/Strings.php:178
    16711704msgid "Availability"
    16721705msgstr "Доступность"
    16731706
    1674 #: lib/Helper.php:700 src/Strings.php:221
     1707#: lib/Helper.php:718 src/Strings.php:221
    16751708msgid "Reputation"
    16761709msgstr "Репутация"
    16771710
    1678 #: lib/Helper.php:702 src/Strings.php:222
     1711#: lib/Helper.php:720 src/Strings.php:222
    16791712msgid "Technologies"
    16801713msgstr "Технологии"
    16811714
    1682 #: lib/Helper.php:704 src/Strings.php:179
     1715#: lib/Helper.php:722 src/Strings.php:179
    16831716msgid "Ports"
    16841717msgstr "Порты"
    16851718
    1686 #: lib/Helper.php:705 src/Common.php:84 src/Strings.php:120
     1719#: lib/Helper.php:723 src/Common.php:89 src/Strings.php:120
    16871720msgid "Firewall"
    16881721msgstr "Файрвол"
    16891722
    1690 #: lib/Helper.php:706 src/Common.php:86 src/PageHandler.php:314
    1691 #: src/PageHandler.php:605 src/Strings.php:121
     1723#: lib/Helper.php:724 src/Common.php:91 src/PageHandler.php:315
     1724#: src/PageHandler.php:606 src/Strings.php:121
    16921725msgid "Antivirus"
    16931726msgstr "Антивирус"
    16941727
    1695 #: lib/Helper.php:707
     1728#: lib/Helper.php:725
    16961729msgid "Domain"
    16971730msgstr "Домен"
    16981731
    1699 #: lib/Helper.php:723
     1732#: lib/Helper.php:741
    17001733msgid "Availability log"
    17011734msgstr "Журнал доступности"
    17021735
    1703 #: lib/Helper.php:724
     1736#: lib/Helper.php:742
    17041737msgid "Deface log"
    17051738msgstr "Журнал дефейсов"
    17061739
    1707 #: lib/Helper.php:725
     1740#: lib/Helper.php:743
    17081741msgid "Port log"
    17091742msgstr "Журнал портов"
    17101743
    1711 #: lib/Helper.php:726
     1744#: lib/Helper.php:744
    17121745msgid "Reputation log"
    17131746msgstr "Журнал репутации"
    17141747
    1715 #: lib/Helper.php:727
     1748#: lib/Helper.php:745
    17161749msgid "Evaluation log"
    17171750msgstr "Журнал оценки"
    17181751
    1719 #: lib/Helper.php:728
     1752#: lib/Helper.php:746
    17201753msgid "Antivirus log"
    17211754msgstr "Журнал антивируса"
    17221755
    1723 #: lib/Helper.php:729
     1756#: lib/Helper.php:747
    17241757msgid "Firewall log"
    17251758msgstr "Журнал файрвола"
    17261759
    1727 #: lib/Helper.php:745
     1760#: lib/Helper.php:763
    17281761msgid "All modules"
    17291762msgstr "Все модули"
    17301763
    1731 #: lib/Helper.php:770
     1764#: lib/Helper.php:788
    17321765msgid "Don't worry, your reputation is good"
    17331766msgstr "Не волнуйтесь, у вас хорошая репутация"
    17341767
    1735 #: lib/Helper.php:774
     1768#: lib/Helper.php:792
    17361769msgid "Oh, your reputation is bad"
    17371770msgstr "Упс, у вашего сайта плохая репутация"
    17381771
    1739 #: lib/Helper.php:778
     1772#: lib/Helper.php:796
    17401773msgid "Information is being updated"
    17411774msgstr "Информация обновляется"
    17421775
    1743 #: lib/Helper.php:898
     1776#: lib/Helper.php:916
    17441777msgid "Blocked IP"
    17451778msgstr "Заблокирован IP"
    17461779
    1747 #: lib/Helper.php:898
     1780#: lib/Helper.php:916
    17481781msgid "Not blocked"
    17491782msgstr "Не заблокирован"
     1783
     1784#: lib/Helper.php:1408
     1785msgid "Error:"
     1786msgstr "Ошибка:"
     1787
     1788#: lib/Helper.php:1408
     1789msgid "Info:"
     1790msgstr "Инфо:"
    17501791
    17511792#: lib/Interface.php:132
     
    17771818msgstr "Нет шаблона: "
    17781819
    1779 #: lib/login/BFProtection.php:36
     1820#: lib/modules/login/BFProtection.php:36
    17801821#, php-format
    17811822msgid "Exceeded the maximum number of login failures which is: %1$s."
     
    17841825"составляет:%1$s."
    17851826
    1786 #: lib/login/BFProtection.php:63
     1827#: lib/modules/login/BFProtection.php:61
    17871828#, php-format
    17881829msgid ""
     
    17931834"<a href=\"%2$s\" title=\"Восстановить пароль\">Потеряли свой пароль</a>?"
    17941835
    1795 #: lib/login/BFProtection.php:76
     1836#: lib/modules/login/BFProtection.php:74
    17961837#, php-format
    17971838msgid ""
     
    18021843"установлено на:%1$s"
    18031844
    1804 #: lib/login/Login.php:162
     1845#: lib/modules/login/Login.php:162
    18051846#, php-format
    18061847msgid "Two-Factor Authentication Recovery Codes. %s (%s)"
    18071848msgstr "Коды Восстановления Двухфакторной Аутентификации. %s (%s)"
    18081849
    1809 #: lib/login/Login.php:163
     1850#: lib/modules/login/Login.php:163
    18101851msgid ""
    18111852"Each line is a single recovery code, with optional spaces for readability. "
     
    18161857"следующие:"
    18171858
    1818 #: src/Common.php:79
     1859#: lib/modules/logs/EventListener.php:24
     1860#, php-format
     1861msgid "User authentication succeeded: %s"
     1862msgstr "Аутентификация пользователя прошла успешно: %s"
     1863
     1864#: lib/modules/logs/EventListener.php:38
     1865#, php-format
     1866msgid "User authentication failed: %s"
     1867msgstr "Ошибка аутентификации пользователя: %s"
     1868
     1869#: lib/modules/logs/EventListener.php:52 lib/modules/logs/EventListener.php:53
     1870#: lib/modules/logs/EventListener.php:167
     1871#: lib/modules/logs/EventListener.php:193
     1872#: lib/modules/logs/EventListener.php:219
     1873#: lib/modules/logs/EventListener.php:245
     1874msgid "unknown"
     1875msgstr "неизвестно"
     1876
     1877#: lib/modules/logs/EventListener.php:63 src/Strings.php:326
     1878msgid "User account created"
     1879msgstr "Создан аккаунт пользователя"
     1880
     1881#: lib/modules/logs/EventListener.php:64
     1882#, php-format
     1883msgid "ID: %s; name: %s; email: %s; roles: %s"
     1884msgstr "ID: %s; имя: %s; email: %s; роли: %s"
     1885
     1886#: lib/modules/logs/EventListener.php:86
     1887#, fuzzy, php-format
     1888#| msgid "User account deleted; ID: %d"
     1889msgid "User account deleted; ID: %d, name: %s"
     1890msgstr "Аккаунт пользователя удален; ID: %d"
     1891
     1892#: lib/modules/logs/EventListener.php:104 src/Strings.php:328
     1893msgid "User account edited"
     1894msgstr "Внесены изменения в аккаунт пользователя"
     1895
     1896#: lib/modules/logs/EventListener.php:106
     1897#, fuzzy
     1898#| msgid "User account edited"
     1899msgid "User account: "
     1900msgstr "Внесены изменения в аккаунт пользователя"
     1901
     1902#: lib/modules/logs/EventListener.php:115
     1903msgid "has been changed"
     1904msgstr "был изменен"
     1905
     1906#: lib/modules/logs/EventListener.php:138
     1907#, php-format
     1908msgid "Attempt to reset password: %s"
     1909msgstr "Попытка сбросить пароль: %s"
     1910
     1911#: lib/modules/logs/EventListener.php:152
     1912#, php-format
     1913msgid "Password retrieval attempt: %s"
     1914msgstr "Попытка восстановления пароля: %s"
     1915
     1916#: lib/modules/logs/EventListener.php:175 src/Strings.php:331
     1917msgid "User added to website"
     1918msgstr "Пользователь добавлен на веб-сайт"
     1919
     1920#: lib/modules/logs/EventListener.php:176
     1921#: lib/modules/logs/EventListener.php:202
     1922#, php-format
     1923msgid "blog: %s; name: %s;"
     1924msgstr "блог: %s; имя: %s;"
     1925
     1926#: lib/modules/logs/EventListener.php:201 src/Strings.php:332
     1927msgid "User removed from website"
     1928msgstr "Пользователь удален с веб-сайта"
     1929
     1930#: lib/modules/logs/EventListener.php:231
     1931#, php-format
     1932msgid "Bookmark link added; ID: %s; name: %s; url: %s; target: %s"
     1933msgstr "Добавлена ссылка; ID: %s; имя: %s; url: %s; target: %s"
     1934
     1935#: lib/modules/logs/EventListener.php:256
     1936#, php-format
     1937msgid "Bookmark link edited; ID: %s; name: %s; url: %s; target: %s"
     1938msgstr "Изменена ссылка; ID: %s; имя: %s; url: %s; target: %s"
     1939
     1940#: lib/modules/logs/EventListener.php:273
     1941#, php-format
     1942msgid "Category created; ID: %s; name: %s"
     1943msgstr "Категория создана; ID: %s; имя: %s"
     1944
     1945#: lib/modules/logs/EventListener.php:300
     1946msgid "Publication"
     1947msgstr "Публикация"
     1948
     1949#: lib/modules/logs/EventListener.php:301
     1950#: lib/modules/logs/EventListener.php:314
     1951msgid "published"
     1952msgstr "опубликован"
     1953
     1954#: lib/modules/logs/EventListener.php:309
     1955msgid "updated"
     1956msgstr "обновлен"
     1957
     1958#: lib/modules/logs/EventListener.php:321
     1959#, php-format
     1960msgid "%s was %s; ID: %s; name: %s"
     1961msgstr "%s был %s; ID: %s; имя: %s"
     1962
     1963#: lib/modules/logs/EventListener.php:359
     1964#, php-format
     1965msgid "ID: %s"
     1966msgstr "ID: %s"
     1967
     1968#: lib/modules/logs/EventListener.php:360
     1969#, php-format
     1970msgid "Old status: %s"
     1971msgstr "Старый статус: %s"
     1972
     1973#: lib/modules/logs/EventListener.php:361
     1974#, php-format
     1975msgid "New status: %s"
     1976msgstr "Новый статус: %s"
     1977
     1978#: lib/modules/logs/EventListener.php:364
     1979#, php-format
     1980msgid "Title: %s"
     1981msgstr "Название: %s"
     1982
     1983#: lib/modules/logs/EventListener.php:368
     1984#, php-format
     1985msgid "%s status has been changed"
     1986msgstr "%s статус был изменен"
     1987
     1988#: lib/modules/logs/EventListener.php:405 src/Strings.php:341
     1989msgid "Post deleted"
     1990msgstr "Пост удален"
     1991
     1992#: lib/modules/logs/EventListener.php:455
     1993#, php-format
     1994msgid "Post moved to trash; ID: %s; name: %s; status: %s"
     1995msgstr "Пост перемещен в корзину; ID: %s; имя: %s; статус: %s"
     1996
     1997#: lib/modules/logs/EventListener.php:492
     1998#, php-format
     1999msgid "Media file added; ID: %s; name: %s; type: %s"
     2000msgstr "Добавлен медиафайл; ID: %s; имя: %s; тип: %s"
     2001
     2002#: lib/modules/logs/EventListener.php:508
     2003msgid "activated"
     2004msgstr "активирован"
     2005
     2006#: lib/modules/logs/EventListener.php:522
     2007msgid "deactivated"
     2008msgstr "деактивирован"
     2009
     2010#: lib/modules/logs/EventListener.php:558
     2011#, php-format
     2012msgid "Plugin %s"
     2013msgstr "Плагин %s"
     2014
     2015#: lib/modules/logs/EventListener.php:582
     2016#, php-format
     2017msgid "Theme activated: %s"
     2018msgstr "Тема активирована: %s"
     2019
     2020#: lib/modules/logs/EventListener.php:598
     2021#, php-format
     2022msgid "WordPress updated to version: %s"
     2023msgstr "WordPress обновлен до версии: %s"
     2024
     2025#: lib/modules/logs/EventListener.php:620
     2026#, php-format
     2027msgid ""
     2028"The value of the option <b>%s</b> was changed from <b>'%s'</b> to <b>'%s'</"
     2029"b>.<br>\n"
     2030msgstr ""
     2031"Значение параметра <b>%s</b> было изменено с <b>'%s'</b> на <b>'%s'</b>."
     2032"<br>\n"
     2033
     2034#: lib/modules/logs/EventListener.php:629
     2035msgid "Common"
     2036msgstr "Общие"
     2037
     2038#: lib/modules/logs/EventListener.php:633
     2039msgid "Global"
     2040msgstr "Глобальные"
     2041
     2042#: lib/modules/logs/EventListener.php:647
     2043#, php-format
     2044msgid "%s settings changed"
     2045msgstr "%s настройки изменены"
     2046
     2047#: lib/modules/logs/EventListener.php:649 src/Strings.php:347
     2048msgid "Settings changed"
     2049msgstr "Настройки изменены"
     2050
     2051#: lib/modules/logs/EventListener.php:694
     2052msgid "Themes updated: (multiple entries): "
     2053msgstr "Темы обновлены: (несколько записей):"
     2054
     2055#: lib/modules/logs/EventListener.php:696
     2056msgid "Theme updated:"
     2057msgstr "Тема обновлена:"
     2058
     2059#: lib/modules/logs/EventListener.php:723
     2060#, php-format
     2061msgid "Theme editor used in: %s/%s"
     2062msgstr "Был использован редактор тем в: %s/%s"
     2063
     2064#: lib/modules/logs/EventListener.php:744
     2065#, php-format
     2066msgid "Theme installed: %s"
     2067msgstr "Тема установлена: %s"
     2068
     2069#: lib/modules/logs/EventListener.php:779
     2070#, php-format
     2071msgid "Theme deleted: %s"
     2072msgstr "Тема удалена: %s"
     2073
     2074#: lib/modules/logs/EventListener.php:827
     2075msgid "Plugins deleted: (multiple entries):"
     2076msgstr "Удаленные плагины: (несколько записей):"
     2077
     2078#: lib/modules/logs/EventListener.php:829
     2079msgid "Plugin deleted:"
     2080msgstr "Плагин удален:"
     2081
     2082#: lib/modules/logs/EventListener.php:856
     2083#, php-format
     2084msgid "Plugin editor used in: %s"
     2085msgstr "Был использован редактор плагинов в: %s"
     2086
     2087#: lib/modules/logs/EventListener.php:882
     2088#, php-format
     2089msgid "Plugin installed: %s"
     2090msgstr "Установлен плагин: %s"
     2091
     2092#: lib/modules/logs/EventListener.php:935
     2093msgid "Plugins updated: (multiple entries):"
     2094msgstr "Плагины обновлены: (несколько записей):"
     2095
     2096#: lib/modules/logs/EventListener.php:937
     2097msgid "Plugin updated:"
     2098msgstr "Обновлен плагин:"
     2099
     2100#: lib/modules/logs/EventListener.php:979
     2101msgid "deleted"
     2102msgstr "удален"
     2103
     2104#: lib/modules/logs/EventListener.php:984
     2105msgid "added"
     2106msgstr "добавлен"
     2107
     2108#: lib/modules/logs/EventListener.php:991
     2109#, php-format
     2110msgid "Widget %s "
     2111msgstr "Виджет %s"
     2112
     2113#: lib/modules/logs/EventListener.php:994
     2114#, php-format
     2115msgid "%s (%s) %s %s (#%d; size %dx%d)"
     2116msgstr "%s (%s) %s %s (#%d; размер %dx%d)"
     2117
     2118#: src/Common.php:84
    18192119msgid "All sites"
    18202120msgstr "Все сайты"
    18212121
    1822 #: src/Common.php:83 src/Strings.php:119
     2122#: src/Common.php:88 src/Strings.php:119
    18232123msgid "Dashboard"
    18242124msgstr "Главная"
    18252125
    1826 #: src/Common.php:87 src/Strings.php:122
     2126#: src/Common.php:92 src/Strings.php:122
    18272127msgid "Settings"
    18282128msgstr "Настройки"
    18292129
    1830 #: src/Common.php:89 src/Strings.php:123
     2130#: src/Common.php:94 src/Strings.php:123
    18312131msgid "Reports"
    18322132msgstr "Отчеты"
    18332133
    1834 #: src/Common.php:90 src/Strings.php:113
     2134#: src/Common.php:95 src/Strings.php:113
    18352135msgid "Documentation"
    18362136msgstr "Документация"
    18372137
    1838 #: src/Common.php:106 src/Common.php:107
     2138#: src/Common.php:96
     2139msgid "WP scan"
     2140msgstr "WP scan"
     2141
     2142#: src/Common.php:112 src/Common.php:113
    18392143msgid "WebTotem"
    18402144msgstr "WebTotem"
    18412145
    1842 #: src/Common.php:130 src/Common.php:131
     2146#: src/Common.php:136 src/Common.php:137
    18432147msgid "Activation"
    18442148msgstr "Активация"
    18452149
    1846 #: src/PageHandler.php:243 src/PageHandler.php:476 src/PageHandler.php:496
     2150#: src/PageHandler.php:244 src/PageHandler.php:477 src/PageHandler.php:497
    18472151msgid "Firewall activity"
    18482152msgstr "Файрвол активность"
    18492153
    1850 #: src/PageHandler.php:283 src/PageHandler.php:285
     2154#: src/PageHandler.php:284 src/PageHandler.php:286
    18512155msgid "Server resources"
    18522156msgstr "Ресурсы сервера"
    18532157
    1854 #: src/PageHandler.php:286
     2158#: src/PageHandler.php:287
    18552159msgid ""
    18562160"Displays critical data about web-server usage. A large load on a server can "
     
    18602164"на сервер может замедлить работу сайта."
    18612165
    1862 #: src/PageHandler.php:336
     2166#: src/PageHandler.php:337
    18632167msgid "Monitoring"
    18642168msgstr "Мониторинг"
    18652169
    1866 #: src/PageHandler.php:379
     2170#: src/PageHandler.php:380
    18672171msgid "Scanning"
    18682172msgstr "Сканирование"
    18692173
    1870 #: src/PageHandler.php:552 src/PageHandler.php:671
     2174#: src/PageHandler.php:553 src/PageHandler.php:672
    18712175msgid "Sorry, you are not allowed to view this page."
    18722176msgstr "Извините, вам не разрешен просмотр этой страницы."
     
    19802284msgstr "Показывает настройки разрешений или прав доступа."
    19812285
    1982 #: src/Strings.php:55
     2286#: src/Strings.php:55 src/Strings.php:320
    19832287msgid "Time"
    19842288msgstr "Время"
     
    20872391msgid "Low risk"
    20882392msgstr "Низкий риск"
    2089 
    2090 #: src/Strings.php:97
    2091 msgid "Attack from"
    2092 msgstr "Атаки из"
    20932393
    20942394#: src/Strings.php:99
     
    26992999
    27003000#: src/Strings.php:282
     3001msgid "save"
     3002msgstr "сохранить"
     3003
     3004#: src/Strings.php:283
     3005msgid "close"
     3006msgstr "закрыть"
     3007
     3008#: src/Strings.php:284
     3009msgid "Block countries"
     3010msgstr "Заблокировать страны"
     3011
     3012#: src/Strings.php:285
     3013msgid "Name of the country"
     3014msgstr "Название страны"
     3015
     3016#: src/Strings.php:286
     3017msgid "Select all countries"
     3018msgstr "Выбрать все страны"
     3019
     3020#: src/Strings.php:287
     3021msgid "Access blocked to"
     3022msgstr "Доступ заблокирован в"
     3023
     3024#: src/Strings.php:288
     3025msgid "countries"
     3026msgstr "странах"
     3027
     3028#: src/Strings.php:289
     3029msgid "Country blocking"
     3030msgstr "Блокировка стран"
     3031
     3032#: src/Strings.php:290
     3033msgid "Block countries you want to limit access to your website."
     3034msgstr ""
     3035"Заблокируйте страны, в которых вы хотите ограничить доступ к своему веб-"
     3036"сайту."
     3037
     3038#: src/Strings.php:296
    27013039msgid "WebTotem two-factor protection"
    27023040msgstr "WebTotem двухфакторная защита"
    27033041
    2704 #: src/Strings.php:283
     3042#: src/Strings.php:297
    27053043msgid "Edit 2FA Settings"
    27063044msgstr "Редактировать настройки"
    27073045
    2708 #: src/Strings.php:284
     3046#: src/Strings.php:298
    27093047msgid "Disactivate 2FA"
    27103048msgstr "Деактивировать"
    27113049
    2712 #: src/Strings.php:290
     3050#: src/Strings.php:304
    27133051msgid "Services status"
    27143052msgstr "Статус сервисов"
    27153053
    2716 #: src/Strings.php:291
     3054#: src/Strings.php:305
    27173055msgid "Site name"
    27183056msgstr "Название сайта"
    27193057
    2720 #: src/Strings.php:292
     3058#: src/Strings.php:306
    27213059msgid "Report page"
    27223060msgstr "Страница отчета"
    27233061
    2724 #: src/Strings.php:293
     3062#: src/Strings.php:307
    27253063msgid "All stats"
    27263064msgstr "Статистика"
    27273065
    2728 #: src/Strings.php:297
     3066#: src/Strings.php:310
    27293067msgid "Try reinstalling the agents or changing the API key"
    27303068msgstr "Попробуйте переустановить агенты или заменить API ключ "
    27313069
    2732 #: src/Strings.php:298
     3070#: src/Strings.php:311
    27333071msgid "Data access error"
    27343072msgstr "Ошибка доступа к данным"
    27353073
     3074#: src/Strings.php:314
     3075msgid "Logs"
     3076msgstr "Логи"
     3077
     3078#: src/Strings.php:315
     3079msgid ""
     3080"Log of user actions. And logs on found links, scripts and iframes in "
     3081"published posts and in files of active plugins and the current theme of the "
     3082"site."
     3083msgstr ""
     3084"Журнал действий пользователей. И записи по найденным ссылкам, скриптам и "
     3085"iframe в опубликованных постах и в файлах активных плагинов и текущей темы "
     3086"сайта."
     3087
     3088#: src/Strings.php:316
     3089msgid "Audit Logs"
     3090msgstr "Журнал событий"
     3091
     3092#: src/Strings.php:317
     3093msgid "Links"
     3094msgstr "Ссылки"
     3095
     3096#: src/Strings.php:318
     3097msgid "Scripts"
     3098msgstr "Скрипты"
     3099
     3100#: src/Strings.php:319
     3101msgid "iFrames"
     3102msgstr "Фреймы"
     3103
     3104#: src/Strings.php:321
     3105msgid "User"
     3106msgstr "Пользователь"
     3107
     3108#: src/Strings.php:322
     3109msgid "Event"
     3110msgstr "Событие"
     3111
     3112#: src/Strings.php:323
     3113msgid "All"
     3114msgstr "Все"
     3115
     3116#: src/Strings.php:324
     3117msgid "User authentication succeeded"
     3118msgstr "Аутентификация пользователя прошла успешно"
     3119
     3120#: src/Strings.php:325
     3121msgid "User authentication failed"
     3122msgstr "Ошибка аутентификации пользователя"
     3123
     3124#: src/Strings.php:327 src/Strings.php:334
     3125msgid "User account deleted"
     3126msgstr "Aккаунт пользователя удален"
     3127
     3128#: src/Strings.php:329
     3129msgid "Attempt to reset password"
     3130msgstr "Попытка сбросить пароль"
     3131
     3132#: src/Strings.php:330
     3133msgid "Password retrieval attempt"
     3134msgstr "Попытка восстановления пароля"
     3135
     3136#: src/Strings.php:333
     3137msgid "WordPress updated"
     3138msgstr "WordPress обновлен"
     3139
     3140#: src/Strings.php:335
     3141msgid "Bookmark link added"
     3142msgstr "Добавлена ссылка"
     3143
     3144#: src/Strings.php:336
     3145msgid "Bookmark link edited"
     3146msgstr "Ссылка изменена"
     3147
     3148#: src/Strings.php:337
     3149msgid "Category created"
     3150msgstr "Категория создана"
     3151
     3152#: src/Strings.php:338
     3153msgid "Publication was published"
     3154msgstr "Запись была опубликована"
     3155
     3156#: src/Strings.php:339
     3157msgid "Publication was updated"
     3158msgstr "Запись обновлена"
     3159
     3160#: src/Strings.php:340
     3161msgid "Post status has been changed"
     3162msgstr "Статус записи был изменен"
     3163
     3164#: src/Strings.php:342
     3165msgid "Post moved to trash"
     3166msgstr "Запись перемещена в корзину"
     3167
     3168#: src/Strings.php:343
     3169msgid "Media file added"
     3170msgstr "Добавлен медиафайл"
     3171
     3172#: src/Strings.php:344
     3173msgid "Plugin activated"
     3174msgstr "Плагин активирован"
     3175
     3176#: src/Strings.php:345
     3177msgid "Plugin deactivated"
     3178msgstr "Плагин деактивирован"
     3179
     3180#: src/Strings.php:346
     3181msgid "Theme activated"
     3182msgstr "Тема активирована"
     3183
     3184#: src/Strings.php:348
     3185msgid "Plugins deleted"
     3186msgstr "Плагин удален"
     3187
     3188#: src/Strings.php:349
     3189msgid "Plugin editor used"
     3190msgstr "Был использован редактор плагинов"
     3191
     3192#: src/Strings.php:350
     3193msgid "Plugin installed"
     3194msgstr "Установлен плагин"
     3195
     3196#: src/Strings.php:351
     3197msgid "Plugins updated"
     3198msgstr "Плагин обновлен"
     3199
     3200#: src/Strings.php:352
     3201msgid "Theme deleted"
     3202msgstr "Тема удалена"
     3203
     3204#: src/Strings.php:353
     3205msgid "Theme editor used"
     3206msgstr "Был использован редактор тем"
     3207
     3208#: src/Strings.php:354
     3209msgid "Theme installed"
     3210msgstr "Тема установлена"
     3211
     3212#: src/Strings.php:355
     3213msgid "Themes updated"
     3214msgstr "Тема обновлена"
     3215
     3216#: src/Strings.php:356
     3217msgid "Widget deleted"
     3218msgstr "Виджет удален"
     3219
     3220#: src/Strings.php:357
     3221msgid "Widget added"
     3222msgstr "Виджет добавлен"
     3223
     3224#, php-format
     3225#~ msgid "Post deleted: (multiple entries): %s"
     3226#~ msgstr "Пост удален: (несколько записей): %s"
     3227
    27363228#~ msgid "Two-Factor Deactivate"
    27373229#~ msgstr "Деактивация Двухфакторная "
     
    27643256#~ msgstr "Атаки"
    27653257
    2766 #~ msgid "Attacks blocked"
    2767 #~ msgstr "Заблокировано атак"
    2768 
    27693258#~ msgid "The reinstall process failed."
    27703259#~ msgstr "Процесс переустановки завершен неудачей."
     
    28023291#~ msgid "Go back"
    28033292#~ msgstr "Назад"
    2804 
    2805 #~ msgid "close"
    2806 #~ msgstr "закрыть"
    28073293
    28083294#~ msgid "Information"
  • wt-security/trunk/lib/API.php

    r2797028 r2837032  
    336336    $period = WebTotem::getPeriod($days);
    337337
    338     $payload = '{"query":"query($id: ID!, $dateRange: DateRangeInput!, $language: Language!, $dateRangeWeek: DateRangeInput!, $wafLogFilter: WafLogFilter!) { auth { viewer { sites { one(id: $id) { ports { status ip tcp ignorePorts lastTest { time } } availability { status lastTest { time } responseTime downTime(dateRange: $dateRange) percent(dateRange: $dateRange) } deface { status lastTest { time } words count } domain { status registrar owner email createdDate expiredDate } ports { status lastTest { time } ip tcp country } ssl { status daysLeft expiryDate issueDate } reputation { status lastTest { time } virusList { virus{ type path } antiVirus } } firewall { lastTest { time } logs(wafLogFilter: $wafLogFilter){ edges{ node{ type blocked payload ip proxyIp userAgent description source region signatureId location{ country{ nameEn } } time request status country category } } } map(dateRange: $dateRange) { attacks, country } status chart(dateRange: $dateRange) { time attacks blocked } report(dateRange: $dateRange) { time attacks ip } } serverStatus { info { phpVersion phpServerUser phpServerSoftware phpGatewayInterface phpServerProtocol osInfo cpuCount cpuModel CpuFreq cpuFamily lsCpu maxExecTime mathLibraries } ramChart(dateRange: $dateRangeWeek){ total value time } cpuChart(dateRange: $dateRangeWeek){ value time } discUsage{ total free } status } maliciousScript { lastTest { time } status } scoring( language: $language ){ score lastTest{ time } result{ ip country isHigherThan }} agentManager{ createdAt } antivirus { status stats { changed deleted scanned infected error } lastTest { time } isFirstCheck } } } } } }","variables":{"id":"' . $host_id . '","dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '}, "dateRangeWeek":{"to":' . $period['to'] . ',"from":' . $period['from'] . '}, "wafLogFilter": {"dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '},"order":{"direction":"DESC","field":"time"},"pagination":{"first": 10,"cursor":null}}, "language":"' . $language . '"}}';
     338    $payload = '{"query":"query($id: ID!, $dateRange: DateRangeInput!, $language: Language!, $dateRangeWeek: DateRangeInput!, $wafLogFilter: WafLogFilter!) { auth { viewer { sites { one(id: $id) { ports { status ip tcp lastTest { time } ignorePorts country } availability { status lastTest { time } responseTime downTime(dateRange: $dateRange) percent(dateRange: $dateRange) } deface { status lastTest { time } words count } domain { status registrar owner email createdDate expiredDate } ssl { status daysLeft expiryDate issueDate } reputation { status lastTest { time } virusList { virus{ type path } antiVirus } } firewall { lastTest { time } logs(wafLogFilter: $wafLogFilter){ edges{ node{ type blocked payload ip proxyIp userAgent description source region signatureId location{ country{ nameEn } } time request status country category } } } map(dateRange: $dateRange) { attacks, country } status chart(dateRange: $dateRange) { time attacks blocked } report(dateRange: $dateRange) { time attacks ip } } serverStatus { info { phpVersion phpServerUser phpServerSoftware phpGatewayInterface phpServerProtocol osInfo cpuCount cpuModel CpuFreq cpuFamily lsCpu maxExecTime mathLibraries } ramChart(dateRange: $dateRangeWeek){ total value time } cpuChart(dateRange: $dateRangeWeek){ value time } discUsage{ total free } status } maliciousScript { lastTest { time } status } scoring( language: $language ){ score lastTest{ time } result{ ip country isHigherThan }} agentManager{ createdAt } antivirus { status stats { changed deleted scanned infected error } lastTest { time } isFirstCheck } } } } } }","variables":{"id":"' . $host_id . '","dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '}, "dateRangeWeek":{"to":' . $period['to'] . ',"from":' . $period['from'] . '}, "wafLogFilter": {"dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '},"order":{"direction":"DESC","field":"time"},"pagination":{"first": 10,"cursor":null}}, "language":"' . $language . '"}}';
    339339    $response = self::sendRequest($payload, TRUE);
    340340
     
    431431    $period = WebTotem::getPeriod($params['days']);
    432432
    433     $payload = '{"operationName":null,"variables":{"id":"' . $params['host_id'] . '","avLogFilter":{' . $permissions . '"event":' . $event . ', "dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '},"order":{"direction":"DESC","field":"time"},"pagination":{"first":' . $params['limit'] . ',"cursor":' . $cursor . '}}},"query":"query ($id: ID!, $avLogFilter: AvLogFilter!) { auth { viewer { sites { one(id: $id) { id ... on Site { configs { ... on AvConfig { isActive id } } } antivirus { quarantine{ id path date } status log(avLogFilter: $avLogFilter) { edges { node { filePath event signatures time permissions permissionsChanged } } pageInfo { endCursor hasNextPage __typename } } lastTest { time } stats { changed deleted scanned infected }  } } } } } }"}';
     433    $payload = '{"operationName":null,"variables":{"id":"' . $params['host_id'] . '","avLogFilter":{' . $permissions . '"event":' . $event . ', "dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '},"order":{"direction":"DESC","field":"time"},"pagination":{"first":' . $params['limit'] . ',"cursor":' . $cursor . '}}},"query":"query ($id: ID!, $avLogFilter: AvLogFilter!) { auth { viewer { sites { one(id: $id) { id ... on Site { configs { ... on AvConfig { isActive id } } } antivirus { quarantine{ id path date } status log(avLogFilter: $avLogFilter) { edges { node { filePath event signatures time permissions permissionsChanged } } pageInfo { endCursor hasNextPage } } lastTest { time } stats { changed deleted scanned infected }  } } } } } }"}';
    434434    $response = self::sendRequest($payload, TRUE);
    435435
     
    883883  }
    884884
     885    /**
     886     * Method to get blocked countries list.
     887     *
     888     * @param string $host_id
     889     *   Host id on WebTotem.
     890     *
     891     * @return array
     892     *   Returns blocked countries list.
     893     */
     894    public static function getBlockedCountries($host_id) {
     895        $period = WebTotem::getPeriod(7);
     896        $payload = '{"variables":{"dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '}} , "query":"query($dateRange: DateRangeInput!){ auth { viewer { sites { one(id: \"' . $host_id . '\"){ firewall{ blockedCountries map(dateRange: $dateRange) { attacks, country, location { country { nameEn } } }  } } } } } }"}';
     897        $response = self::sendRequest($payload, TRUE);
     898
     899        if (isset($response['data']['auth']['viewer']['sites']['one']['firewall'])) {
     900            return $response['data']['auth']['viewer']['sites']['one']['firewall'];
     901        }
     902
     903        return [];
     904    }
     905
     906    /**
     907     * Method for synchronizing data on the list of blocked countries.
     908     *
     909     * @param string $host_id
     910     *   Host id on WebTotem.
     911     * @param array $countries
     912     *   Array of countries to block.
     913     *
     914     * @return bool|string
     915     *   Returns information whether the request was successful.
     916     */
     917    public static function syncBlockedCountries($host_id, $countries) {
     918
     919        $countries = $countries ? WebTotem::convertArrayToString($countries) : '';
     920        $payload = '{"variables":{ "input": { "siteId": "' . $host_id . '", "countries": [' . $countries . '] } }, "query":"mutation($input: WafBlockedCountriesInput!,) { auth { sites { waf { syncBlockedCountries(input: $input) } } } }"} ';
     921        $response = self::sendRequest($payload, TRUE);
     922
     923        if (isset($response['data']['auth']['sites']['waf']['syncBlockedCountries'])) {
     924            return $response['data']['auth']['sites']['waf']['syncBlockedCountries'];
     925        }
     926
     927        return FALSE;
     928    }
     929
    885930  /**
    886931   * Method to get user's email.
     
    890935   */
    891936  public static function getEmail(){
    892       $payload = '{"query":"query { auth { viewer { email __typename } __typename } }"}';
     937      $payload = '{"query":"query { auth { viewer { email  } } }"}';
    893938      $response = self::sendRequest($payload, true);
    894939
  • wt-security/trunk/lib/Ajax.php

    r2797028 r2837032  
    66        die('Protected By WebTotem!');
    77    }
    8    
     8
    99    class WebTotemAjax {
    10    
     10
    1111        /**
    1212         * Activation plugin.
     
    1515         */
    1616        public static function activation() {
    17    
     17
    1818            if (WebTotemRequest::post('ajax_action') !== 'activation') {
    1919                return;
    2020            }
    21    
     21
    2222            if($api_key = WebTotemRequest::post('api_key')) {
    23    
     23
    2424                $result = WebTotemAPI::auth($api_key);
    25    
     25
    2626                if($result == 'success') {
    2727                    if(WebTotem::isMultiSite()) {
     
    3636                    ], 200);
    3737                } else {
    38    
     38
    3939                    wp_send_json([
    4040                        'notifications' => self::notifications(),
     
    4343                }
    4444            }
    45    
    46         }
    47    
     45
     46        }
     47
    4848        /**
    4949         * The process of installing agents (WAF, AV) on the main page.
     
    5252         */
    5353        public static function agentsInstallation() {
    54    
     54
    5555            if (WebTotemRequest::post('ajax_action') !== 'agents_installation') {
    5656                return;
    5757            }
    58    
     58
    5959            $av_installed = WebTotemOption::getOption('av_installed');
    6060            $waf_installed = WebTotemOption::getOption('waf_installed');
    61    
     61
    6262            // Check if the agents are installed.
    6363            if ($av_installed and $waf_installed) {
     
    7373                $host = WebTotemAPI::siteInfo();
    7474                $data = WebTotemAPI::getAgentsStatusesFromAPI($host['id']);
    75    
     75
    7676                $agents_statuses = [
    7777                    'av' => $data['av']['status'],
    7878                    'waf' => $data['waf']['status'],
    7979                ];
    80    
     80
    8181                $agents_statuses = WebTotem::getAgentsStatuses($agents_statuses);
    8282            }
    83    
     83
    8484            $build[] = [
    8585                'variables' => [
     
    8888                'template' => 'agents_installation',
    8989            ];
    90    
     90
    9191            $status = [
    9292                'av' => $agents_statuses['process_statuses']['av'] == 'installed',
    9393                'waf' => $agents_statuses['process_statuses']['waf'] == 'installed',
    9494            ];
    95    
     95
    9696            WebTotemOption::setOptions([
    9797                'av_installed' => $status['av'],
    9898                'waf_installed' => $status['waf'],
    9999            ]);
    100    
     100
    101101            $template = new WebTotemTemplate();
    102102            $agents = $template->arrayRender($build);
    103    
     103
    104104            wp_send_json([
    105105                'success' => true,
     
    109109            ]);
    110110        }
    111    
    112    
     111
    113112        /**
    114113         * Reinstall agents.
     
    117116         */
    118117        public static function reinstallAgents() {
    119    
     118
    120119            if (WebTotemRequest::post('ajax_action') !== 'reinstall_agents') {
    121120                return;
    122121            }
    123    
     122
    124123            if (WebTotemAgentManager::removeAgents()) {
    125124                WebTotemAgentManager::amInstall();
     
    128127            $response['redirect_link'] = WebTotem::adminURL('admin.php?page=wtotem');
    129128            wp_send_json($response);
    130    
    131         }
    132    
     129
     130        }
     131
    133132        /**
    134133         * Deleting plugin activation data and redirecting to the activation page.
     
    137136         */
    138137        public static function logout() {
    139    
     138
    140139            if (WebTotemRequest::post('ajax_action') !== 'logout') {
    141140                return;
    142141            }
    143    
     142
    144143            WebTotemOption::logout();
    145    
     144
    146145            $response['success'] = true;
    147146            $response['redirect_link'] = WebTotem::adminURL('admin.php?page=wtotem_activation');
    148147            wp_send_json($response);
    149    
    150         }
    151    
     148
     149        }
     150
    152151        /**
    153152         * Creating a modal window.
     
    156155         */
    157156        public static function popup() {
    158    
     157
    159158            if (WebTotemRequest::post('ajax_action') !== 'popup') {
    160159                return;
    161160            }
    162    
     161
    163162            $action = WebTotemRequest::post('popup_action');
    164163            $template = new WebTotemTemplate();
    165    
     164
    166165            if($action){
    167166                switch ($action) {
     
    176175                        ];
    177176                        break;
    178    
     177
    179178                    case 'logout':
    180179                        $build[] = [
     
    188187                        break;
    189188                }
    190    
     189
    191190                wp_send_json([
    192191                    'success' => true,
     
    194193                ]);
    195194            }
    196    
     195
    197196            wp_send_json([
    198197                'success' => false,
    199198            ]);
    200    
    201         }
    202    
     199
     200        }
     201
    203202        /**
    204203         * Request to update charts with parameters.
     
    207206         */
    208207        public static function chart() {
    209    
     208
    210209            if (WebTotemRequest::post('ajax_action') !== 'chart') {
    211210                return;
    212211            }
    213    
     212
    214213            $template = new WebTotemTemplate();
    215    
     214
    216215            $days = (integer) WebTotemRequest::post('days');
    217216            $service = WebTotemRequest::post('service');
    218    
     217
    219218            $host = WebTotemAPI::siteInfo();
    220    
     219
    221220            switch ($service) {
    222221                case 'waf':
    223    
     222
    224223                    WebTotemOption::setSessionOptions(['firewall_period' => $days]);
    225    
     224
    226225                    // Firewall chart.
    227226                    $data = WebTotemAPI::getFirewallChart($host['id'], $days);
    228227                    $chart = WebTotem::generateWafChart($data['chart']);
    229    
     228
    230229                    $_chart[] = [
    231230                        'variables' => [
     
    235234                        'template' => 'firewall_chart',
    236235                    ];
    237    
     236
    238237                    // Firewall logs.
    239238                    $data = WebTotemAPI::getFirewall($host['id'], 10, NULL, $days);
    240239                    $firewall = $data['firewall'];
    241    
     240
    242241                    $waf_logs[] = [
    243242                        'variables' => [
     
    246245                        'template' => 'firewall_logs',
    247246                    ];
    248    
     247
    249248                    // Firewall stats.
    250249                    $waf_stats[] = [
     
    258257                        'template' => 'firewall_stats',
    259258                    ];
    260    
     259
    261260                    WebTotemOption::setSessionOptions([
    262261                        'firewall_cursor' => $firewall['logs']['pageInfo']['endCursor'],
    263262                    ]);
    264    
     263
    265264                    $has_next_page = $firewall['logs']['pageInfo']['hasNextPage'];
    266    
     265
    267266                    $response = [
    268267                        'chart' => $template->arrayRender($_chart),
     
    272271                        'service' => 'waf',
    273272                    ];
    274    
    275                     break;
    276    
     273
     274                    break;
     275
    277276                case 'cpu':
    278277                    WebTotemOption::setSessionOptions(['cpu_period' => $days]);
    279    
     278
    280279                    $data = WebTotemAPI::getServerStatusData($host['id'], $days);
    281280                    $chart = WebTotem::generateChart($data['cpuChart'], $days);
    282    
     281
    283282                    $_chart[] = [
    284283                        'variables' => [
     
    288287                        'template' => 'cpu_chart',
    289288                    ];
    290    
     289
    291290                    $response = [
    292291                        'chart' => $template->arrayRender($_chart),
    293292                        'service' => 'cpu',
    294293                    ];
    295    
    296                     break;
    297    
     294
     295                    break;
     296
    298297                case 'ram':
    299298                    WebTotemOption::setSessionOptions(['ram_period' => $days]);
    300    
     299
    301300                    $data = WebTotemAPI::getServerStatusData($host['id'], $days);
    302301                    $chart = WebTotem::generateChart($data['ramChart'], $days);
    303    
     302
    304303                    $_chart[] = [
    305304                        'variables' => [
     
    309308                        'template' => 'ram_chart',
    310309                    ];
    311    
     310
    312311                    $response = [
    313312                        'chart' => $template->arrayRender($_chart),
    314313                        'service' => 'ram',
    315314                    ];
    316    
    317                     break;
    318    
     315
     316                    break;
     317
    319318                case 'map':
    320319                    $data = WebTotemAPI::getFirewallChart($host['id'], $days);
    321320                    $chart = WebTotem::generateAttacksMapChart($data['map']);
    322321                    $world_map_json = WEBTOTEM_URL . '/includes/js/world_map.json';
    323    
     322
    324323                    $_chart[] = [
    325324                        'variables' => [
     
    329328                        'template' => 'map_chart',
    330329                    ];
    331    
     330
    332331                    $response = [
    333332                        'chart' => $template->arrayRender($_chart),
    334333                        'service' => 'map',
    335334                    ];
    336    
    337                     break;
    338    
    339             }
    340    
     335
     336                    break;
     337
     338            }
     339
    341340            if ($service) {
    342341                $response['success'] = true;
     
    344343                wp_send_json($response);
    345344            }
    346    
    347         }
    348    
     345
     346        }
     347
    349348        /**
    350349         * Data lazy load.
    351    
     350
    352351         * @return void
    353352         */
    354353        public static function lazyLoad() {
    355    
    356    
     354
     355
    357356            if (WebTotemRequest::post('ajax_action') !== 'lazy_load') {
    358357                return;
    359358            }
    360    
     359
    361360            $template = new WebTotemTemplate();
    362    
     361
    363362            $service = WebTotemRequest::post('service');
    364    
     363
    365364            $host = WebTotemAPI::siteInfo();
    366    
     365
    367366            switch ($service) {
    368367                case 'all_sites':
    369368                    $cursor = WebTotemOption::getSessionOption('sites_cursor') ?: NULL;
    370369                    $allSites = WebTotemAPI::getSites($cursor);
    371    
     370
    372371                    $has_next_page = $allSites['pageInfo']['hasNextPage'];
    373    
     372
    374373                    WebTotemOption::setSessionOptions([
    375374                        'sites_cursor' => $allSites['pageInfo']['endCursor'],
    376375                    ]);
    377    
     376
    378377                    // Sites list.
    379378                    $build[] = [
     
    384383                        'template' => 'multisite_list'
    385384                    ];
    386    
    387                     break;
    388    
     385
     386                    break;
     387
    389388                case 'firewall':
    390389                    $cursor = WebTotemOption::getSessionOption('firewall_cursor') ?: NULL;
     
    393392                    $service_data = $data['firewall'];
    394393                    $has_next_page = $service_data['logs']['pageInfo']['hasNextPage'];
    395    
     394
    396395                    WebTotemOption::setSessionOptions([
    397396                        'firewall_cursor' => $service_data['logs']['pageInfo']['endCursor'],
    398397                    ]);
    399    
     398
    400399                    // Firewall logs.
    401400                    $build[] = [
     
    405404                        'template' => 'firewall_logs',
    406405                    ];
    407    
    408                     break;
    409    
     406
     407                    break;
     408
    410409                case 'antivirus':
    411410                    $cursor = WebTotemOption::getSessionOption('antivirus_cursor') ?: NULL;
    412411                    $event = WebTotemOption::getSessionOption('antivirus_event') ?: NULL;
    413412                    $permissions = WebTotemOption::getSessionOption('antivirus_permissions') ?: NULL;
    414    
     413
    415414                    $params = [
    416415                        'host_id' => $host['id'],
     
    421420                        'permissions' => $permissions,
    422421                    ];
    423    
     422
    424423                    $data = WebTotemAPI::getAntivirus($params);
    425424                    $has_next_page = $data['log']['pageInfo']['hasNextPage'];
    426    
     425
    427426                    WebTotemOption::setSessionOptions([
    428427                        'antivirus_cursor' => $data['log']['pageInfo']['endCursor'],
    429428                    ]);
    430    
     429
    431430                    // Antivirus logs.
    432431                    $build[] = [
     
    436435                        'template' => 'antivirus_logs',
    437436                    ];
    438    
    439                     break;
    440    
     437
     438                    break;
     439
    441440                case 'reports':
    442441                    $cursor = WebTotemOption::getSessionOption('reports_cursor') ?: NULL;
    443    
     442
    444443                    $data = WebTotemAPI::getAllReports($host['id'], 10, $cursor);
    445444                    $has_next_page = $data['pageInfo']['hasNextPage'];
    446    
     445
    447446                    WebTotemOption::setSessionOptions([
    448447                        'reports_cursor' => $data['pageInfo']['endCursor'],
    449448                    ]);
    450    
     449
    451450                    // Reports.
    452451                    $build[] = [
     
    457456                        'template' => 'reports_list',
    458457                    ];
    459    
    460                     break;
    461    
     458
     459                    break;
     460
    462461                case 'reports_m':
    463462                    $cursor = WebTotemOption::getSessionOption('reports_m_cursor') ?: NULL;
    464    
     463
    465464                    $data = WebTotemAPI::getAllReports($host['id'], 10, $cursor);
    466465                    $has_next_page = $data['pageInfo']['hasNextPage'];
    467    
     466
    468467                    WebTotemOption::setSessionOptions([
    469468                        'reports_m_cursor' => $data['pageInfo']['endCursor'],
    470469                    ]);
    471    
     470
    472471                    // Reports mobile.
    473472                    $build[] = [
     
    478477                        'template' => 'reports_list_mobile',
    479478                    ];
    480    
    481                     break;
    482             }
    483    
     479
     480                    break;
     481            }
     482
    484483            if ($service) {
    485    
     484
    486485                wp_send_json([
    487486                    'success' => true,
     
    492491            }
    493492        }
    494    
    495    
     493
     494        /**
     495         * Data lazy load.
     496
     497         * @return void
     498         */
     499        public static function logs() {
     500            if (WebTotemRequest::post('ajax_action') !== 'logs') {
     501                return;
     502            }
     503
     504            $template = new WebTotemTemplate();
     505            $logs_action = WebTotemRequest::post('logs_action');
     506
     507            switch ($logs_action) {
     508                case 'audit_logs_pagination':
     509                    $order = WebTotemRequest::post('order') === 'ascending' ? 'ASC' : 'DESC';
     510                    $current_page = (int) WebTotemRequest::post('current_page');
     511                    $event = WebTotemRequest::post('event');
     512                    $filter = $event === 'All' ? [] : ['LIKE', ['event' => $event . '%']];
     513
     514                    $audit_logs = WebTotemDB::getRows(
     515                        $filter,
     516                        'audit_logs',
     517                        false,
     518                        ['limit' => 10, 'page' => $current_page],
     519                        ['order_by' => 'created_at', 'direction' => $order]
     520                    );
     521
     522                    $build[] = [
     523                        'variables' => [
     524                            "audit_logs" => WebTotem::getAuditLogs($audit_logs['data'], $audit_logs['dates_count']),
     525                        ],
     526                        'template' => 'scan_audit_logs',
     527                    ];
     528
     529                     $response = [
     530                         'success' => true,
     531                         'content' => $template->arrayRender($build),
     532                         "pagination" => WebTotem::paginationBuild(10, $audit_logs['count'], $current_page),
     533                         'notifications' => self::notifications(),
     534                     ];
     535
     536                    break;
     537
     538                case 'audit_logs_sort_filter':
     539                    $order = WebTotemRequest::post('order') === 'ascending' ? 'ASC' : 'DESC';
     540                    $event = WebTotemRequest::post('event');
     541                    $filter = $event === 'All' ? [] : ['LIKE', ['event' => $event . '%']];
     542                    $audit_logs = WebTotemDB::getRows(
     543                        $filter,
     544                        'audit_logs',
     545                        false,
     546                        ['limit' => 10, 'page' => 1],
     547                        ['order_by' => 'created_at', 'direction' => $order]
     548                    );
     549
     550                    $build[] = [
     551                        'variables' => [
     552                            "audit_logs" => WebTotem::getAuditLogs($audit_logs['data'], $audit_logs['dates_count']),
     553                        ],
     554                        'template' => 'scan_audit_logs',
     555                    ];
     556
     557                    $response = [
     558                        'success' => true,
     559                        'content' => $template->arrayRender($build),
     560                        "pagination" => WebTotem::paginationBuild(10, $audit_logs['count'], 1),
     561                        'notifications' => self::notifications(),
     562                    ];
     563
     564                    break;
     565
     566                case 'logs_pagination':
     567                    $current_page = (int) WebTotemRequest::post('current_page');
     568                    $type = WebTotemRequest::post('type');
     569
     570                    $scan_logs = WebTotemDB::getRows(
     571                        ['AND',['data_type' =>  $type]],
     572                        'scan_logs',
     573                        'content',
     574                        ['limit' => 10, 'page' => $current_page],
     575                    );
     576
     577                    $build[] = [
     578                        'variables' => [
     579                            "logs" => $scan_logs['data'],
     580                            "data_type" => $type
     581                        ],
     582                        'template' => 'scan_logs_items',
     583                    ];
     584
     585                    $response = [
     586                        'success' => true,
     587                        'content' => $template->arrayRender($build),
     588                        "pagination" => WebTotem::paginationBuild(10, $scan_logs['count'], $current_page),
     589                        'notifications' => self::notifications(),
     590                    ];
     591
     592                    break;
     593            }
     594
     595            wp_send_json($response);
     596        }
     597
    496598        /**
    497599         * Add date filter.
     
    500602         */
    501603        public static function wafDateFilter() {
    502    
     604
    503605            if (WebTotemRequest::post('ajax_action') !== 'waf_date_filter') {
    504606                return;
    505607            }
    506    
     608
    507609            $template = new WebTotemTemplate();
    508    
     610
    509611            $date_from = WebTotemRequest::post('date_from');
    510    
     612
    511613            $period = explode(" to ", $date_from);
    512614            WebTotemOption::setSessionOptions(['firewall_period' => $period]);
    513    
     615
    514616            $host = WebTotemAPI::siteInfo();
    515    
     617
    516618            // Firewall logs.
    517619            $data = WebTotemAPI::getFirewall($host['id'], 10, NULL, $period);
    518620            $firewall = $data['firewall'];
    519    
     621
    520622            $waf_logs[] = [
    521623                'variables' => [
     
    524626                'template' => 'firewall_logs',
    525627            ];
    526    
     628
    527629            // Firewall chart.
    528630            $data = WebTotemAPI::getFirewallChart($host['id'], $period);
    529631            $chart = WebTotem::generateWafChart($data['chart']);
    530    
     632
    531633            $_chart[] = [
    532634                'variables' => [
     
    536638                'template' => 'firewall_chart',
    537639            ];
    538    
     640
    539641            // Firewall stats.
    540642            $waf_stats[] = [
     
    548650                'template' => 'firewall_stats',
    549651            ];
    550    
     652
    551653            WebTotemOption::setSessionOptions([
    552654                'firewall_cursor' => $firewall['logs']['pageInfo']['endCursor'],
    553655            ]);
    554    
     656
    555657            $has_next_page = $firewall['logs']['pageInfo']['hasNextPage'];
    556    
     658
    557659            $response = [
    558660                'success' => true,
     
    563665                'notifications' => self::notifications(),
    564666            ];
    565    
     667
    566668            wp_send_json($response);
    567669        }
    568    
    569    
     670
     671
    570672        /**
    571673         * Request to restart re-scan and receive antivirus data.
     
    574676         */
    575677        public static function antivirus() {
    576    
     678
    577679            if (WebTotemRequest::post('ajax_action') !== 'antivirus') {
    578680                return;
    579681            }
    580    
     682
    581683            $action = WebTotemRequest::post('av_action');
    582    
     684
    583685            $host = WebTotemAPI::siteInfo();
    584    
     686
    585687            switch ($action) {
    586688                case 'rescan':
    587689                    $response = WebTotemAPI::forceCheck($host['id'], 'av');
    588    
     690
    589691                    if (!isset($response['errors'])) {
    590692                        $data = WebTotemAPI::getAntivirusLastTest($host['id']);
    591693                        $response['last_scan'] = WebTotem::dateFormatter($data['lastTest']['time']);
    592    
    593                     }
    594                     break;
    595    
     694                    }
     695                    break;
     696
    596697                case 'download_report':
    597698                    $response = WebTotemAPI::avExport($host['id']);
     
    600701                    }
    601702                    break;
    602    
     703
    603704                case 'filter':
    604    
     705
    605706                    $file_status = WebTotemRequest::post('file_status');
    606707                    $permission = filter_var( WebTotemRequest::post('permission'), FILTER_VALIDATE_BOOLEAN);
    607    
     708
    608709                    WebTotemOption::setSessionOptions([
    609710                        'antivirus_permissions' => $permission,
    610711                        'antivirus_event' => $file_status,
    611712                    ]);
    612    
     713
    613714                    $params = [
    614715                        'host_id' => $host['id'],
     
    619720                        'permissions' => $permission,
    620721                    ];
    621    
     722
    622723                    $data = WebTotemAPI::getAntivirus($params);
    623724                    $has_next_page = $data['log']['pageInfo']['hasNextPage'];
    624    
     725
    625726                    WebTotemOption::setSessionOptions([
    626727                        'antivirus_cursor' => $data['log']['pageInfo']['endCursor'],
    627728                    ]);
    628    
     729
    629730                    // Antivirus logs.
    630731                    $build[] = [
     
    634735                        'template' => 'antivirus_logs',
    635736                    ];
    636    
     737
    637738                    $template = new WebTotemTemplate();
    638739                    $response = [
     
    640741                        'has_next_page' => $has_next_page,
    641742                    ];
    642    
    643                     break;
    644             }
    645    
     743
     744                    break;
     745            }
     746
    646747            $response['success'] = true;
    647748            $response['notifications'] = self::notifications();
    648    
     749
    649750            wp_send_json($response);
    650751        }
    651    
     752
    652753        /**
    653754         * Request to add a file to quarantine.
     
    659760                return;
    660761            }
    661    
     762
    662763            $action = WebTotemRequest::post('quarantine_action');
    663764            $id_or_path = WebTotemRequest::post('id_or_path');
    664    
     765
    665766            $host = WebTotemAPI::siteInfo();
    666767            $response = [];
    667    
     768
    668769            switch ($action) {
    669770                case 'add':
    670771                    $api_response = WebTotemAPI::moveToQuarantine($host['id'], $id_or_path);
    671772                    break;
    672    
     773
    673774                case 'remove':
    674775                    $api_response = WebTotemAPI::moveFromQuarantine($id_or_path);
    675776                    break;
    676777            }
    677    
     778
    678779            if (!isset($api_response['errors'])) {
    679    
     780
    680781                $quarantine_logs = WebTotemAPI::getQuarantineList($host['id']);
    681782                $quarantine_count = count($quarantine_logs);
    682    
     783
    683784                // Quarantine logs.
    684785                $quarantine[] = [
     
    689790                    'template' => 'quarantine',
    690791                ];
    691    
     792
    692793                $cursor = WebTotemOption::getSessionOption('antivirus_cursor') ?: NULL;
    693794                $event = WebTotemOption::getSessionOption('antivirus_event') ?: NULL;
    694795                $permissions = WebTotemOption::getSessionOption('antivirus_permissions') ?: NULL;
    695    
     796
    696797                $params = [
    697798                    'host_id' => $host['id'],
     
    702803                    'permissions' => $permissions,
    703804                ];
    704    
     805
    705806                $data = WebTotemAPI::getAntivirus($params);
    706807                WebTotemCache::setData(['getAntivirus' => $data], $host['id']);
    707    
     808
    708809                $has_next_page = $data['log']['pageInfo']['hasNextPage'];
    709    
     810
    710811                WebTotemOption::setSessionOptions([
    711812                    'antivirus_cursor' => $data['log']['pageInfo']['endCursor'],
    712813                ]);
    713    
     814
    714815                // Antivirus logs.
    715816                $antivirus_logs[] = [
     
    719820                    'template' => 'antivirus_logs',
    720821                ];
    721    
    722    
     822
     823
    723824                $template = new WebTotemTemplate();
    724825                $response = [
     
    727828                    'has_next_page' => $has_next_page,
    728829                ];
    729    
    730             }
    731    
     830
     831            }
     832
    732833            $response['success'] = true;
    733834            $response['notifications'] = self::notifications();
    734    
     835
    735836            wp_send_json($response);
    736    
    737         }
    738    
     837
     838        }
     839
    739840        /**
    740841         * Request to add or remove a port to the ignore list.
     
    743844         */
    744845        public static function ignorePorts() {
    745    
     846
    746847            if (WebTotemRequest::post('ajax_action') !== 'ignore_ports') {
    747848                return;
    748849            }
    749    
     850
    750851            $template = new WebTotemTemplate();
    751    
     852
    752853            $action = WebTotemRequest::post('port_action');
    753854            $port = (int) WebTotemRequest::post('port');
    754    
     855
    755856            $host = WebTotemAPI::siteInfo();
    756    
     857
    757858            switch ($action) {
    758859                case 'add':
    759860                    $response = WebTotemAPI::addIgnorePort($host['id'], $port);
    760861                    break;
    761    
     862
    762863                case 'remove':
    763864                    $response = WebTotemAPI::removeIgnorePort($host['id'], $port);
    764865                    break;
    765866            }
    766    
     867
    767868            if (!isset($response['errors'])) {
    768    
     869
    769870                $ports = WebTotemAPI::getAllPortsList($host['id']);
    770871                $open_ports[] = [
     
    774875                    'template' => 'open_ports',
    775876                ];
    776    
     877
    777878                $ignore_ports[] = [
    778879                    'variables' => [
     
    785886                    'ignore_ports' => $template->arrayRender($ignore_ports),
    786887                ];
    787    
    788             }
    789    
     888
     889            }
     890
    790891            $response['success'] = true;
    791892            $response['notifications'] = self::notifications();
    792    
     893
    793894            wp_send_json($response);
    794895        }
    795    
     896
    796897        /**
    797898         * Request for a report link.
     
    800901         */
    801902        public static function reports() {
    802    
     903
    803904            if (WebTotemRequest::post('ajax_action') !== 'reports') {
    804905                return;
    805906            }
    806    
     907
    807908            $template = new WebTotemTemplate();
    808    
     909
    809910            $action = WebTotemRequest::post('report_action');
    810    
     911
    811912            switch ($action) {
    812913                case 'download':
     
    818919                    break;
    819920                case 'report_form':
    820    
     921
    821922                    $period = explode(" to ", WebTotemRequest::post('date_period'));
    822923                    $modules_data = WebTotemRequest::post('modules');
    823    
     924
    824925                    $modules = [
    825926                        'wa' => 'false',
     
    831932                        'waf' => 'false'
    832933                    ];
    833    
     934
    834935                    foreach ($modules_data as $module => $value){
    835936                        $modules[$module] = 'true';
    836937                    }
    837    
     938
    838939                    $host = WebTotemAPI::siteInfo();
    839940                    $api_response = WebTotemAPI::generateReport($host['id'], $period, $modules);
    840    
     941
    841942                    if (!$api_response) {
    842943                        $massage = '<div class="message error_message">' . __('Report generation error', 'wtotem') . '</div>';
     
    845946                        $data = WebTotemAPI::getAllReports($host['id']);
    846947                        WebTotemCache::setData(['getAllReports' => $data], $host['id']);
    847    
     948
    848949                        // Reports.
    849950                        $build[] = [
     
    854955                            'template' => 'reports_list',
    855956                        ];
    856    
     957
    857958                        // Reports mobile.
    858959                        $build_mobile[] = [
     
    863964                            'template' => 'reports_list_mobile',
    864965                        ];
    865    
     966
    866967                        $response = [
    867968                            'reports' => $template->arrayRender($build),
     
    869970                            'link' => $api_response,
    870971                        ];
    871    
     972
    872973                        $massage = '<div class="message success_message">' . __('The report was successfully generated', 'wtotem') . '</div>';
    873974                    }
    874    
     975
    875976                    $response['massage'] = $massage;
    876    
    877                     break;
    878             }
    879    
     977
     978                    break;
     979            }
     980
    880981            $response['success'] = true;
    881982            $response['notifications'] = self::notifications();
    882983            wp_send_json($response);
    883984        }
    884    
     985
    885986        /**
    886987         * Request for a report link.
     
    889990         */
    890991        public static function settings() {
    891    
     992
    892993            if (WebTotemRequest::post('ajax_action') !== 'settings') {
    893994                return;
    894995            }
    895    
     996
    896997            $av_installed = WebTotemOption::getOption('av_installed');
    897998            $waf_installed = WebTotemOption::getOption('waf_installed');
    898999            $action = WebTotemRequest::post('settings_action');
    8991000
    900             if(in_array($action, ['module_toggle', 'module_notifications', 'waf_settings', 'add_allow_ip', 'add_deny_ip', 'add_allow_url', 'add_ip_list'])){
     1001            if(in_array($action, ['module_toggle', 'module_notifications', 'waf_settings', 'add_allow_ip', 'add_deny_ip', 'add_allow_url', 'add_ip_list', 'country_blocking'])){
    9011002              if(!$av_installed && !$waf_installed) {
    9021003                WebTotemOption::setNotification('warning', __('It is not possible to make changes because the agents are not installed.', 'wtotem'));
     
    9121013            $host = WebTotemAPI::siteInfo();
    9131014            $template = new WebTotemTemplate();
    914    
     1015
    9151016            switch ($action) {
    916    
     1017
    9171018                case 'module_toggle':
    9181019                    $config = WebTotemAPI::toggleConfigs(WebTotemRequest::post('value'));
    919    
     1020
    9201021                    $configs_data = WebTotemAPI::getConfigs($host['id']);
    9211022                    WebTotemCache::setData(['getConfigs' => $configs_data], $host['id']);
     
    9251026                    $response['success'] = true;
    9261027                    break;
    927    
     1028
     1029                case 'country_blocking':
     1030                    $countries = WebTotemRequest::post('checked_countries');
     1031
     1032                    if(WebTotemAPI::syncBlockedCountries($host['id'], $countries)){
     1033                        $waf_data = WebTotemAPI::getBlockedCountries($host['id']);
     1034                        WebTotemCache::setData(['getBlockedCountries' => $waf_data], $host['id']);
     1035
     1036                        WebTotemOption::setNotification('success', __('Your changes have been applied successfully.', 'wtotem'));
     1037                        $response['blocked_countries_list'] = $waf_data['blockedCountries'];
     1038                        $response['success'] = true;
     1039                    } else {
     1040                        WebTotemOption::setNotification('success', __('Your changes have not been applied.', 'wtotem'));
     1041                        $response['success'] = false;
     1042                    }
     1043
     1044                    break;
     1045
    9281046                case 'module_notifications':
    9291047                    $config = WebTotemAPI::toggleNotifications($host['id'], WebTotemRequest::post('value'));
    930    
     1048
    9311049                    $configs_data = WebTotemAPI::getConfigs($host['id']);
    9321050                    WebTotemCache::setData(['getConfigs' => $configs_data], $host['id']);
     
    9361054                    $response['success'] = true;
    9371055                    break;
    938    
     1056
    9391057                case 'waf_settings':
    940    
     1058
     1059                    $response['success'] = true;
     1060
     1061                    $dos = WebTotemRequest::post('dos');
     1062                    $dos_limit = WebTotemRequest::post('dos_limit');
     1063                    $login_attempt = WebTotemRequest::post('login_attempt');
     1064                    $login_attempt_limit = WebTotemRequest::post('login_attempt_limit');
     1065
     1066                    if($dos){
     1067                        if(empty($dos_limit)){
     1068                            $response['errors']['dos_limit'] = __('The field is required.', 'wtotem');
     1069                        } else if($dos_limit < 500 or $dos_limit > 100000) {
     1070                            $response['success'] = false;
     1071                            $response['errors']['dos_limit'] = sprintf(__('Please specify a value from %s to %s.', 'wtotem'), '500', '100 000');
     1072                        }
     1073                    }
     1074
     1075                    if($login_attempt){
     1076                        if(empty($login_attempt_limit)){
     1077                            $response['errors']['login_attempt_limit'] = __('The field is required.', 'wtotem');
     1078                        } else if($login_attempt_limit < 5 or $login_attempt_limit > 30) {
     1079                            $response['success'] = false;
     1080                            $response['errors']['login_attempt_limit'] = sprintf(__('Please specify a value from %s to %s.', 'wtotem'), '5', '30');
     1081                        }
     1082                    }
     1083
     1084                    if(!$response['success']){
     1085                        break;
     1086                    } else {
     1087                        $response['errors']  = false;
     1088                    }
     1089
    9411090                    $settings = [
    9421091                        'gdn' => WebTotemRequest::post('gdn'),
    943                         'dosProtection' => WebTotemRequest::post('dos'),
    944                         'dosLimit' => WebTotemRequest::post('dos_limit'),
    945                         'loginAttemptsProtection' => WebTotemRequest::post('login_attempt'),
    946                         'loginAttemptsLimit' => WebTotemRequest::post('login_attempt_limit'),
    947                     ];
    948    
     1092                        'dosProtection' => $dos,
     1093                        'dosLimit' => $dos_limit,
     1094                        'loginAttemptsProtection' => $login_attempt,
     1095                        'loginAttemptsLimit' => $login_attempt_limit,
     1096                    ];
     1097
    9491098                    $host = WebTotemAPI::siteInfo();
    9501099                    $api_response = WebTotemAPI::setFirewallSettings($host['id'], $settings);
    951    
     1100
    9521101                    if (!$api_response['errors']) {
    953    
     1102
    9541103                        $data = WebTotemAPI::getIpLists($host['id']);
    9551104                        WebTotemCache::setData(['getIpLists' => $data], $host['id']);
    956    
     1105
    9571106                        WebTotemOption::setNotification('success', __('Your changes have been applied successfully.', 'wtotem'));
    9581107                    }
    959    
    960                     $response['success'] = true;
    961                     break;
    962    
     1108
     1109                    break;
     1110
    9631111                case 'recaptcha_settings':
    964    
     1112
    9651113                    $recaptcha_v3_site_key = WebTotemRequest::post('recaptcha_v3_site_key');
    9661114                    $recaptcha_v3_secret = WebTotemRequest::post('recaptcha_v3_secret');
     
    9971145                        }
    9981146                    }
    999                    
     1147
    10001148                    if($recaptcha){
    10011149                        $settings = [
     
    10051153                    }
    10061154                    $settings['recaptcha'] = $recaptcha;
    1007    
     1155
    10081156                    if($settings['hide_wp_version']){
    10091157                        WebTotemOption::hideReadme();
     
    10111159                        WebTotemOption::restoreReadme();
    10121160                    }
    1013    
     1161
    10141162                    WebTotemOption::setPluginSettings($settings);
    1015    
     1163
    10161164                    WebTotemOption::setNotification('success', __('Your changes have been applied successfully.', 'wtotem'));
    10171165                    WebTotemOption::setNotification('warning', __('Please make sure that no other recaptcha is used on your site. Otherwise, there may be a conflict that will cause problems when logging into the admin panel.', 'wtotem'));
    10181166
    10191167                  $response['success'] = true;
    1020    
    1021    
     1168
     1169
    10221170                    break;
    10231171
     
    10821230                        } else if($data['login_number_of_attempts'] <= 0 or $data['login_number_of_attempts'] > 1000000) {
    10831231                          $response['success'] = false;
    1084                           $response['errors']['login_number_of_attempts'] = __('Please specify a value from 1 to 1000000.', 'wtotem');
     1232                          $response['errors']['login_number_of_attempts'] = sprintf(__('Please specify a value from %s to %s.', 'wtotem'), '1', '1000000');
    10851233                        }
    10861234                    }
     
    11011249                        } else if($data['password_reset_number_of_attempts'] <= 0 or $data['password_reset_number_of_attempts'] > 1000000) {
    11021250                        $response['success'] = false;
    1103                         $response['errors']['password_reset_number_of_attempts'] = __('Please specify a value from 1 to 1000000.', 'wtotem');
     1251                        $response['errors']['password_reset_number_of_attempts'] = sprintf(__('Please specify a value from %s to %s.', 'wtotem'), '1', '1000000');
    11041252                      }
    11051253                    }
     
    11411289                            'template' => 'allow_deny_list',
    11421290                        ];
    1143    
     1291
    11441292                        $response['content'] = $template->arrayRender($build);
    11451293                    }
    1146    
     1294
    11471295                    $response['success'] = true;
    11481296                    break;
    1149    
     1297
    11501298                case 'add_deny_ip':
    11511299                    $api_response = WebTotemAPI::addIpToList($host['id'], WebTotemRequest::post('value'), 'black');
     
    11591307                            'template' => 'allow_deny_list',
    11601308                        ];
    1161    
     1309
    11621310                        $response['content'] = $template->arrayRender($build);
    11631311                    }
    1164    
     1312
    11651313                    $response['success'] = true;
    11661314                    break;
    1167    
     1315
    11681316                case 'add_allow_url':
    11691317                    $api_response = WebTotemAPI::addUrlToAllowList($host['id'], WebTotemRequest::post('value'));
     
    11761324                            'template' => 'allow_url_list',
    11771325                        ];
    1178    
     1326
    11791327                        $response['content'] = $template->arrayRender($build);
    11801328                    }
    1181    
     1329
    11821330                    $response['success'] = true;
    11831331                    break;
    1184    
     1332
    11851333                case 'add_ip_list':
    11861334                    $ips = WebTotemRequest::post('ips');
    11871335                    $list_name = WebTotemRequest::post('list');
    1188    
     1336
    11891337                    $host = WebTotemAPI::siteInfo();
    11901338                    $api_response = WebTotemAPI::addIpToList($host['id'], $ips, $list_name);
    1191    
     1339
    11921340                    if ($api_response) {
    11931341                        $data = WebTotemAPI::getIpLists($host['id']);
    1194    
     1342
    11951343                        $data_list = ($list_name == 'white') ? $data['whiteList'] : $data['blackList'];
    11961344                        $ip_list = ($list_name == 'white') ? 'ip_allow' : 'ip_deny';
    1197    
     1345
    11981346                        $build[] = [
    11991347                            'variables' => [
     
    12021350                            'template' => 'allow_deny_list',
    12031351                        ];
    1204    
     1352
    12051353                        if ($api_response['status'] != 0) {
    12061354                            $response['invalidIPs'] = implode("\n", $api_response['invalidIPs']);
    12071355                        }
    1208    
     1356
    12091357                        $response['wrap'] = ($list_name == 'white') ? '#wtotem_ip_allow_list' : '#wtotem_ip_deny_list';
    12101358                        $response['content'] = $template->arrayRender($build);
    12111359                    }
    12121360                    $response['success'] = true;
    1213    
    1214                     break;
    1215             }
    1216    
     1361
     1362                    break;
     1363            }
     1364
    12171365            $response['notifications'] = self::notifications();
    12181366            wp_send_json($response);
    12191367        }
    1220    
     1368
    12211369        /**
    12221370         * Request to remove from the list of deny/allowed ip or url addresses.
     
    12251373         */
    12261374        public static function remove() {
    1227    
     1375
    12281376            if (WebTotemRequest::post('ajax_action') !== 'remove') {
    12291377                return;
    12301378            }
    1231    
     1379
    12321380            $av_installed = WebTotemOption::getOption('av_installed');
    12331381            $waf_installed = WebTotemOption::getOption('waf_installed');
    1234    
     1382
    12351383            if(!$av_installed && !$waf_installed) {
    12361384                WebTotemOption::setNotification('warning', __('It is not possible to make changes because the agents are not installed.', 'wtotem'));
    1237    
     1385
    12381386                wp_send_json([
    12391387                    'success' => false,
     
    12411389                ]);
    12421390            }
    1243    
     1391
    12441392            $action = WebTotemRequest::post('remove_action');
    12451393            $host = WebTotemAPI::siteInfo();
    12461394            $template = new WebTotemTemplate();
    1247    
     1395
    12481396            switch ($action) {
    12491397                case 'ip_allow':
    12501398                    $api_response = WebTotemAPI::removeIpFromList( WebTotemRequest::post('id') );
    1251    
     1399
    12521400                    if ($api_response) {
    12531401                        $data = WebTotemAPI::getIpLists($host['id']);
    1254    
     1402
    12551403                        $build[] = [
    12561404                            'variables' => [
     
    12591407                            'template' => 'allow_deny_list',
    12601408                        ];
    1261    
     1409
    12621410                        $response['content'] = $template->arrayRender($build);
    12631411                        $response['wrap'] = '#wtotem_ip_allow_list';
    12641412                    }
    12651413                    break;
    1266    
     1414
    12671415                case 'ip_deny':
    12681416                    $api_response = WebTotemAPI::removeIpFromList( WebTotemRequest::post('id') );
    1269    
     1417
    12701418                    if ($api_response) {
    12711419                        $data = WebTotemAPI::getIpLists($host['id']);
    1272    
     1420
    12731421                        $build[] = [
    12741422                            'variables' => [
     
    12771425                            'template' => 'allow_deny_list',
    12781426                        ];
    1279    
     1427
    12801428                        $response['content'] = $template->arrayRender($build);
    12811429                        $response['wrap'] = '#wtotem_ip_deny_list';
    12821430                    }
    12831431                    break;
    1284    
     1432
    12851433                case 'url_allow':
    12861434                    $api_response = WebTotemAPI::removeUrlFromAllowList( WebTotemRequest::post('id') );
    1287    
     1435
    12881436                    if ($api_response) {
    12891437                        $data = WebTotemAPI::getAllowUrlList($host['id']);
    1290    
     1438
    12911439                        $build[] = [
    12921440                            'variables' => [
     
    12951443                            'template' => 'allow_url_list',
    12961444                        ];
    1297    
     1445
    12981446                        $response['content'] = $template->arrayRender($build);
    12991447                        $response['wrap'] = '#wtotem_allow_url';
     
    13011449                    break;
    13021450            }
    1303    
     1451
    13041452            $response['success'] = true;
    13051453            $response['notifications'] = self::notifications();
    13061454            wp_send_json($response);
    13071455        }
    1308    
     1456
    13091457        /**
    13101458         * Request to remove site from WebTotem.
     
    13131461         */
    13141462        public static function multisite() {
    1315    
     1463
    13161464            if (WebTotemRequest::post('ajax_action') !== 'multisite') {
    13171465                return;
    13181466            }
    1319    
     1467
    13201468            $action = WebTotemRequest::post('multisite_action');
    13211469            $template = new WebTotemTemplate();
    1322    
     1470
    13231471            switch ($action) {
    13241472                case 'remove_site':
    1325    
     1473
    13261474                    $host_id = WebTotemRequest::post('hid');
    13271475                    $main_host = WebTotemOption::getMainHost();
    1328    
     1476
    13291477                    if($host_id == $main_host['id']){
    13301478                        WebTotemOption::setNotification('error', __('You cannot delete the primary domain.', 'wtotem'));
     
    13321480                    }
    13331481                    WebTotemAPI::removeMultiSiteHost($host_id);
    1334    
    1335                     break;
    1336    
     1482
     1483                    break;
     1484
    13371485                case 'add_site':
    1338    
     1486
    13391487                    $new_site = WebTotemRequest::post('site_name');
    13401488                    WebTotemAPI::addMultiSiteNewSites([$new_site]);
    1341    
    1342                     break;
    1343             }
    1344    
     1489
     1490                    break;
     1491            }
     1492
    13451493            $allSites = WebTotemAPI::getSites();
    13461494            $has_next_page = $allSites['pageInfo']['hasNextPage'];
    1347    
     1495
    13481496            WebTotemOption::setSessionOptions([
    13491497                'sites_cursor' => $allSites['pageInfo']['endCursor'],
    13501498            ]);
    1351    
     1499
    13521500            // Sites list.
    13531501            $build[] = [
     
    13581506                'template' => 'multisite_list'
    13591507            ];
    1360    
     1508
    13611509            $response['content'] = $template->arrayRender($build);
    1362    
     1510
    13631511            $response['success'] = true;
    13641512            $response['notifications'] = self::notifications();
    13651513            wp_send_json($response);
    13661514        }
    1367    
     1515
    13681516        /**
    13691517         * Request to remove site from WebTotem.
     
    13721520         */
    13731521        public static function twoFactorAuth() {
    1374    
     1522
    13751523            if (WebTotemRequest::post('ajax_action') !== 'two_factor_auth') {
    13761524                return;
    13771525            }
    1378    
     1526
    13791527            $action = WebTotemRequest::post('case_action');
    13801528            $template = new WebTotemTemplate();
     
    13921540                $user = $current_user;
    13931541            }
    1394    
     1542
    13951543            switch ($action) {
    13961544                case 'activate':
    1397    
     1545
    13981546                    $g = new WebTotemGoogleAuthenticator();
    13991547
     
    14011549                    $recovery = WebTotemRequest::post('recovery');
    14021550                    $code = WebTotemRequest::post('code');
    1403    
     1551
    14041552                    if($g->checkCode($secret, $code)){
    14051553                        WebTotemLogin::saveData($user->ID, $recovery, $secret);
     
    14101558                        $response['success'] = false;
    14111559                    }
    1412    
    1413                     break;
    1414    
     1560
     1561                    break;
     1562
    14151563                case 'deactivate':
    14161564
    14171565                    WebTotemLogin::delete($user->ID);
    1418    
     1566
    14191567                    $response['success'] = true;
    1420    
     1568
    14211569                    break;
    14221570            }
     
    14301578                'template' => 'two_factor_auth'
    14311579            ];
    1432    
     1580
    14331581            $response['content'] = $template->arrayRender($build);
    1434    
     1582
    14351583            $response['notifications'] = self::notifications();
    14361584            wp_send_json($response);
    14371585        }
    1438    
     1586
    14391587        /**
    14401588         * Changing the theme mode.
     
    14431591         */
    14441592        public static function changeThemeMode() {
    1445    
     1593
    14461594            if (WebTotemRequest::post('ajax_action') !== 'theme_mode') {
    14471595                return;
    14481596            }
    1449    
     1597
    14501598            $theme_mode = WebTotemOption::getSessionOption('theme_mode');
    1451    
     1599
    14521600            if ($theme_mode == 'dark') {
    14531601                WebTotemOption::setSessionOptions(['theme_mode' => 'light']);
     
    14581606                $response = 'dark';
    14591607            }
    1460    
     1608
    14611609            wp_send_json($response);
    14621610        }
    1463    
     1611
    14641612        /**
    14651613         * Set user time zone offset.
     
    14681616         */
    14691617        public static function userTimeZone() {
    1470    
     1618
    14711619            if (WebTotemRequest::post('ajax_action') !== 'set_time_zone') {
    14721620                return;
    14731621            }
    1474    
     1622
    14751623            $time_zone_offset = WebTotemRequest::post('offset');
    14761624            $now = strtotime('now');
    14771625            $check = WebTotemOption::getOption('time_zone_check') ?: 0;
    1478    
     1626
    14791627            // Checking whether an hour has elapsed since the previous request.
    14801628            if ($now >= $check) {
     
    14861634                WebTotemOption::setOptions(['time_zone_offset' => $time_zone_offset]);
    14871635            }
    1488    
     1636
    14891637            wp_send_json([
    14901638                'success' => true,
    14911639                'time_zone_offset' => $time_zone_offset
    14921640            ]);
    1493    
    1494         }
    1495    
     1641
     1642        }
     1643
    14961644        /**
    14971645         * Updating the page data in the specified time interval.
     
    15001648         */
    15011649        public static function reloadPage() {
    1502    
     1650
    15031651            if (WebTotemRequest::post('ajax_action') !== 'reload_page') {
    15041652                return;
    15051653            }
    1506    
     1654
    15071655            $page = WebTotemRequest::post('page');
    1508    
     1656
    15091657            $template = new WebTotemTemplate();
    1510    
     1658
    15111659            // Get data from WebTotem API.
    15121660            $host = WebTotemAPI::siteInfo();
    1513    
     1661
    15141662            switch ($page) {
    15151663                case 'dashboard':
    1516    
     1664
    15171665                    $data = WebTotemAPI::getAllData($host['id']);
    1518    
     1666
    15191667                    // Start build array for rendering.
    15201668                    // Scoring block.
     
    15351683                        'template' => 'score',
    15361684                    ];
    1537    
     1685
    15381686                    // Firewall stats.
    15391687                    $period = WebTotemOption::getSessionOption('firewall_period');
    15401688                    $service_data = $period ? WebTotemAPI::getFirewall($host['id'], 10, NULL, $period) : $data;
    15411689                    $service_data = $service_data['firewall'];
    1542    
     1690
    15431691                    $chart = WebTotem::generateWafChart($service_data['chart']);
    15441692                    $build['firewall_stats'] = [
     
    15521700                        'template' => 'firewall_stats',
    15531701                    ];
    1554    
     1702
    15551703                    $build['chart_periods'] = [
    15561704                        'variables' => [
     
    15601708                        'template' => 'chart_periods',
    15611709                    ];
    1562    
     1710
    15631711                    // Firewall blocks.
    15641712                    $build['firewall_data'] = [
     
    15701718                        'template' => 'firewall',
    15711719                    ];
    1572    
     1720
    15731721                    // Server Status RAM.
    15741722                    $period = WebTotemOption::getSessionOption('ram_period') ?: 7;
    15751723                    $service_data = $period ? WebTotemAPI::getServerStatusData($host['id'], $period) : $data['serverStatus'];
    1576    
     1724
    15771725                    $build['server_status_ram'] = [
    15781726                        'variables' => [
     
    15831731                        'template' => 'server_status_ram',
    15841732                    ];
    1585    
     1733
    15861734                    // Server Status CPU.
    15871735                    $period = WebTotemOption::getSessionOption('cpu_period') ?: 7;
     
    15921740                            "days" => $period,
    15931741                        ],
    1594    
     1742
    15951743                        'template' => 'server_status_cpu',
    15961744                    ];
    1597    
     1745
    15981746                    // Antivirus stats blocks.
    15991747                    $antivirus_stats = $data['antivirus']['stats'];
     
    16051753                            "infected" => $antivirus_stats["infected"] ?: 0,
    16061754                        ],
    1607    
     1755
    16081756                        'template' => 'antivirus_stats',
    16091757                    ];
    1610    
     1758
    16111759                    // Monitoring blocks.
    16121760                    $build['monitoring'] = [
     
    16361784                        'template' => 'monitoring',
    16371785                    ];
    1638    
     1786
    16391787                    // Scanning blocks.
    16401788                    $disc_usage_data = $data['serverStatus']['discUsage'];
     
    16441792                        'used'  => $disc_usage_data['total'] - $disc_usage_data['free'],
    16451793                    ];
    1646    
     1794
    16471795                    $build['scanning'] = [
    16481796                        'variables' => [
     
    16661814                        'template' => 'scanning',
    16671815                    ];
    1668    
     1816
    16691817                    $response['content'][] = ['selector' => '#scoring', 'content' => $template->arrayRender($build['scoring'])];
    16701818                    $response['content'][] = ['selector' => '#firewall_stats', 'content' => $template->arrayRender($build['firewall_stats'])];
     
    16761824                    $response['content'][] = ['selector' => '#monitoring', 'content' => $template->arrayRender($build['monitoring'])];
    16771825                    $response['content'][] = ['selector' => '#scanning', 'content' => $template->arrayRender($build['scanning'])];
    1678    
    1679                     break;
    1680             }
    1681    
     1826
     1827                    break;
     1828            }
     1829
    16821830            $response['success'] = true;
    16831831            $response['notifications'] = self::notifications();
    16841832            wp_send_json($response);
    16851833        }
    1686    
    1687    
     1834
     1835
    16881836        public static function authenticate() {
    1689    
     1837
    16901838            if (WebTotemRequest::post('ajax_action') !== 'authenticate') {
    16911839                return;
    16921840            }
    1693    
     1841
    16941842            $credentials = array(
    16951843                'log' => 'pwd',
     
    17111859                $response['error'] = wp_kses(sprintf(__('<strong>ERROR</strong>: A username and password must be provided. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), wp_lostpassword_url()), array('strong'=>array(), 'a'=>array('href'=>array(), 'title'=>array())));
    17121860            }
    1713    
     1861
    17141862            do_action_ref_array('wp_authenticate', array(&$username, &$password));
    1715    
     1863
    17161864            $user = wp_authenticate($username, $password);
    17171865            $user = WebTotemBFProtection::checkBruteForceAttempts($user, $username);
    17181866
    17191867            if (is_object($user) && ($user instanceof \WP_User)) {
    1720    
     1868
    17211869                $response['login'] = true;
    1722    
     1870
    17231871                if(WebTotemLogin::hasUser2faActivated($user)){
    1724    
     1872
    17251873                    $template = new WebTotemTemplate();
    17261874
    17271875                    $response['2fa'] = true;
    17281876                    $response['content'] = $template->getHtml( 'login_auth_form' );
    1729    
     1877
    17301878                }
    17311879            } else if (is_wp_error($user)) {
     
    17411889                    }
    17421890                }
    1743    
     1891
    17441892                if (!empty($errors)) {
    17451893                    $errors = implode('<br>', $errors);
    17461894                    $response['error'] = apply_filters('login_errors', $errors);
    17471895                }
    1748    
    1749             }
    1750    
     1896
     1897            }
     1898
    17511899            wp_send_json($response);
    17521900        }
    1753    
     1901
    17541902        /**
    17551903         * Notification output.
     
    17581906         */
    17591907        public static function notifications() {
    1760    
     1908
    17611909            $notifications = WebTotem::getNotifications();
    1762    
     1910
    17631911            if($notifications){
    17641912                $build[] = [
     
    17661914                        'notifications' => $notifications,
    17671915                    ],
    1768    
     1916
    17691917                    'template' => 'notifications',
    17701918                ];
    1771    
     1919
    17721920                $template = new WebTotemTemplate();
    17731921                return $template->arrayRender($build);
    17741922            }
    17751923            return false;
    1776    
    1777         }
    1778 
    1779    
     1924
     1925        }
     1926
     1927
    17801928    }
  • wt-security/trunk/lib/Cache.php

    r2797028 r2837032  
    6767    }
    6868
     69    /**
     70     * Delete data from cache.
     71     *
     72     * @param string $key
     73     *   Data key.
     74     * @param string $host_id
     75     *   The data belongs to this host.
     76     *
     77     * @return bool
     78     */
     79    public static function deleteData($key, $host_id) {
     80
     81        $cache = json_decode(WebTotemOption::getOption('cache'), true) ?: [];
     82
     83        unset($cache[$host_id][$key]);
     84        WebTotemOption::setOptions(['cache' => $cache]);
     85
     86        return TRUE;
     87
     88    }
     89
    6990}
  • wt-security/trunk/lib/DB.php

    r2797028 r2837032  
    1515    const WTOTEM_TABLE_SETTINGS = 'wtotem_settings';
    1616    const WTOTEM_TABLE_BLOCKED_LIST = 'wtotem_blocked_list';
     17    const WTOTEM_TABLE_AUDIT_LOGS = 'wtotem_audit_logs';
     18    const WTOTEM_TABLE_SCAN_LOGS = 'wtotem_scan_logs';
    1719
    1820    /**
     
    4547              reason tinytext,
    4648              blockedTime tinytext,
     49              UNIQUE KEY id (id)
     50            );";
     51
     52            dbDelta($sql);
     53        }
     54
     55        $audit_logs_table = self::add_prefix(self::WTOTEM_TABLE_AUDIT_LOGS);
     56        if($wpdb->get_var("show tables like '$audit_logs_table'") != $audit_logs_table) {
     57
     58            $sql = "CREATE TABLE " . $audit_logs_table . " (
     59              id mediumint(9) NOT NULL AUTO_INCREMENT,
     60              created_at DATETIME NOT NULL,
     61              user_name tinytext,
     62              status tinytext,
     63              event tinytext,
     64              title tinytext,
     65              description text,
     66              ip tinytext,
     67              viewed tinytext,
     68              UNIQUE KEY id (id)
     69            );";
     70
     71            dbDelta($sql);
     72        }
     73
     74        $scan_logs_table = self::add_prefix(self::WTOTEM_TABLE_SCAN_LOGS);
     75        if($wpdb->get_var("show tables like '$scan_logs_table'") != $scan_logs_table) {
     76
     77            $sql = "CREATE TABLE " . $scan_logs_table . " (
     78              id mediumint(9) NOT NULL AUTO_INCREMENT,
     79              created_at DATETIME NOT NULL,
     80              scan_source tinytext,
     81              data_type tinytext,
     82              source tinytext,
     83              content text,
    4784              UNIQUE KEY id (id)
    4885            );";
     
    90127        global $wpdb;
    91128        $table_name = self::getTable($table);
    92 
    93         foreach ($options as $key => $value){
    94             $where[] = $key . " = '" . $value . "'";
    95         }
    96         $where = implode(' AND ', $where);
    97 
    98         $options = $wpdb->get_row( "SELECT * FROM $table_name WHERE $where" );
    99 
    100         return (array) $options ?: [];
    101     }
     129        $where = '';
     130
     131        if($options){
     132            $where = [];
     133            foreach ($options as $key => $value){
     134                $where[] = $key . " = '" . $value . "'";
     135            }
     136            $where = 'WHERE ' . implode(' AND ', $where);
     137        }
     138
     139        $_options = [];
     140        if($wpdb->get_var("show tables like '$table_name'") == $table_name) {
     141            $_options = $wpdb->get_row("SELECT * FROM $table_name $where");
     142        }
     143
     144        return (array) $_options ?: [];
     145    }
     146
     147    /**
     148     * Check availability.
     149     */
     150    public static function checkAvailability ($table, $values, $field) {
     151        global $wpdb;
     152        $table_name = self::getTable($table);
     153        $result = [];
     154
     155        if($wpdb->get_var("show tables like '$table_name'") == $table_name) {
     156            foreach ($values as $value){
     157                $is_exists = $wpdb->get_row( "SELECT COUNT(*) as count FROM $table_name WHERE $field = '$value'" );
     158                if($is_exists->count){
     159                   $result[$value] = __($value, 'wtotem');
     160                }
     161            }
     162        }
     163        return $result;
     164    }
     165
     166    /**
     167     * Getting rows from the table.
     168     *
     169     * @param array $options
     170     *    Option name.
     171     *
     172     * @return array
     173     */
     174    public static function getRows ($options, $table, $group_by = false, $pagination = ['limit' => 10, 'page' => 1], $sort = ['order_by' => 'id', 'direction' => 'DESC']) {
     175        global $wpdb;
     176        $table_name = self::getTable($table);
     177
     178        if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
     179            WebTotemDB::install();
     180        }
     181
     182        if($wpdb->get_var("show tables like '$table_name'") == $table_name) {
     183            $where = '';
     184            if($options){
     185                if($options[0] == 'AND' or $options[0] == 'OR'){
     186                    $where = [];
     187                    foreach ($options[1] as $key => $value){
     188                        if(is_array($value)){
     189                            foreach ($value as $val){
     190                                $where[] = $key . " = '" . $val . "'";
     191                            }
     192                        } else {
     193                            $where[] = $key . " = '" . $value . "'";
     194                        }
     195                    }
     196                    $where = 'WHERE ' . implode(' '.$options[0].' ', $where);
     197                }
     198                if($options[0] == 'LIKE'){
     199                    $where = [];
     200                    foreach ($options[1] as $key => $value){
     201                            $where[] = $key . " LIKE '" . $value . "'";
     202                    }
     203                    $where = 'WHERE ' . implode(' OR ', $where);
     204                }
     205            }
     206
     207            $_pagination = $pagination == 'all' ? '' : 'LIMIT '. $pagination['limit'] .' OFFSET ' . $pagination['limit'] * ($pagination['page'] - 1);
     208            $_sort = 'ORDER BY `' . $sort['order_by'] . '` ' . $sort['direction'];
     209
     210            $_group_by = $group_by ? 'GROUP BY ' . $group_by : '';
     211
     212            $result['data'] = WebTotem::convertObjectToArray( $wpdb->get_results( "SELECT * FROM $table_name $where $_group_by $_sort $_pagination" ) );
     213
     214            if($pagination != 'all'){
     215                if($group_by){
     216                    $count = $wpdb->get_results( "SELECT COUNT(DISTINCT $group_by) as count FROM $table_name $where" );
     217                } else {
     218                    $count = $wpdb->get_results( "SELECT COUNT(*) as count FROM $table_name $where" );
     219                }
     220            }
     221
     222            $result['count'] = !empty($count) ? $count[0]->count : 0;
     223
     224            if($table == 'audit_logs'){
     225
     226                // Set viewed mark.
     227                $ids = implode(",", array_column($result['data'], 'id'));
     228                if( $ids ) $wpdb->query( "UPDATE $table_name SET viewed = 1 WHERE id in ($ids)" );
     229
     230                // Get dates count
     231                $created_at = array_column($result['data'], 'created_at');
     232                $dates = [];
     233                foreach ($created_at as $value){
     234                    $dates[] = date_i18n('Y-m-d', strtotime($value));
     235                }
     236                $dates = array_unique($dates);
     237                foreach ($dates as $date){
     238                    $count = $wpdb->get_results( "SELECT COUNT(*) as count FROM $table_name WHERE created_at BETWEEN '$date 00:00:00' AND '$date 23:59:59'" );
     239                    $dates_count[date_i18n('M j, Y', strtotime($date))] = $count[0]->count;
     240                }
     241                $result['dates_count'] = $dates_count ?? [];
     242            }
     243        }
     244        return $result ?? ['data' => [], 'count' => 0];
     245    }
    102246
    103247    /**
     
    105249     */
    106250    public static function uninstall() {
    107         $tables = [ self::WTOTEM_TABLE_SETTINGS, self::WTOTEM_TABLE_BLOCKED_LIST ];
     251        $tables = [
     252            self::WTOTEM_TABLE_SETTINGS,
     253            self::WTOTEM_TABLE_BLOCKED_LIST,
     254            self::WTOTEM_TABLE_AUDIT_LOGS,
     255            self::WTOTEM_TABLE_SCAN_LOGS,
     256        ];
    108257        foreach ($tables as $table) {
    109258            global $wpdb;
     
    121270    public static function add_prefix($table) {
    122271        global $wpdb;
    123         return $wpdb->prefix . $table;
     272        return $wpdb->base_prefix . $table;
    124273    }
    125274
     
    133282            case 'blocked_list':
    134283                return self::add_prefix(self::WTOTEM_TABLE_BLOCKED_LIST);
     284            case 'audit_logs':
     285                return self::add_prefix(self::WTOTEM_TABLE_AUDIT_LOGS);
     286            case 'scan_logs':
     287                return self::add_prefix(self::WTOTEM_TABLE_SCAN_LOGS);
    135288        }
    136289
  • wt-security/trunk/lib/Helper.php

    r2797028 r2837032  
    7979
    8080    /**
    81      * Returns the md5 hash representing the content of a file.
     81     * Returns full path to image.
    8282     *
    8383     * @param  string $image
    8484     *    Relative path to the file.
    8585     * @return string
    86      *    Seven first characters in the hash of the file.
     86     *    Full path to image.
    8787     */
    8888    public static function getImagePath($image) {
    8989        return WEBTOTEM_URL. '/includes/img/' . $image;
    9090    }
     91
     92    /**
     93     * Convert object to array.
     94     *
     95     * @param array $data
     96     *    Array.
     97     * @return array
     98     *    Returns array.
     99     */
     100    public static function convertObjectToArray($data) {
     101
     102        if(!is_array($data)) $data = (array)$data;
     103        array_walk_recursive($data, function(&$item){
     104            if(is_object($item)) $item = (array)$item;
     105        });
     106
     107        return $data;
     108    }
    91109
    92110    /**
     
    11871205   * @param array $map
    11881206   *   Map logs from WebTotem.
    1189    * @param int $count_attacks
    1190    *   Total attacks.
    11911207   *
    11921208   * @return array
     
    12081224    return ['percent' => 0, 'country' => FALSE, 'offset' => 0];
    12091225  }
     1226
     1227    /**
     1228     * Get data on the three most attacking countries.
     1229     *
     1230     * @param array $map
     1231     *   Map logs from WebTotem.
     1232     *
     1233     * @return array
     1234     *   Returns array of data.
     1235     */
     1236    public static function getTreeMostAttacksData($map) {
     1237        $total_attacks = array_sum(array_column($map, 'attacks'));
     1238
     1239        if ($map) {
     1240            array_multisort (array_column($map, 'attacks'), SORT_DESC, $map);
     1241            $data = array_slice($map, 0, 3);
     1242
     1243            foreach ($data as $key => $value){
     1244                $data[$key]['percent'] = round($value['attacks'] / $total_attacks * 100);
     1245                $data[$key]['country'] = self::getCountryName($value['country']);
     1246            }
     1247
     1248            return $data;
     1249        }
     1250
     1251        return [];
     1252    }
    12101253
    12111254  /**
     
    13331376
    13341377    /**
    1335      * Encodes the less than, greater than, ampersand,double quote
    1336      * and single quote characters. Will never double encode entities.
    1337      *
    1338      * @see https://developer.wordpress.org/reference/functions/esc_attr/
    1339      *
    1340      * @param  string $text
    1341      *     The text which is to be encoded.
    1342      *
    1343      * @return string
    1344      *    The encoded text with HTML entities.
    1345      */
    1346     public static function escape($text = '')
    1347     {
    1348         return esc_attr($text);
    1349     }
     1378     * Encodes the less than, greater than, ampersand,double quote
     1379     * and single quote characters. Will never double encode entities.
     1380     *
     1381     * @see https://developer.wordpress.org/reference/functions/esc_attr/
     1382     *
     1383     * @param  string $text
     1384     *     The text which is to be encoded.
     1385     *
     1386     * @return string
     1387     *    The encoded text with HTML entities.
     1388     */
     1389    public static function escape($text = '') {
     1390        return esc_attr($text);
     1391    }
     1392
     1393    /**
     1394     * Throw generic exception.
     1395     *
     1396     * @throws Exception
     1397     *
     1398     * @param  string $message
     1399     *   Error or information message.
     1400     * @param  string $type
     1401     *   Either info or error.
     1402     *
     1403     * @return bool
     1404     *    False all the time, used for debug.
     1405     */
     1406    public static function throwException($message, $type = 'error') {
     1407        if (defined('WTOTEM_THROW_EXCEPTIONS') && WTOTEM_THROW_EXCEPTIONS === true && is_string($message) ) {
     1408            $message = str_replace( '<strong>WebTotem:</strong>', ($type === 'error' ? __('Error:', 'wtotem') : __('Info:', 'wtotem')), $message );
     1409            throw new Exception($message, $type === 'error' ? 157 : 333);
     1410        }
     1411        return false;
     1412    }
     1413
     1414    /**
     1415     * Get audit logs data
     1416     *
     1417     * @return array
     1418     */
     1419    public static function getAuditLogs($data, $dates_count) {
     1420        $logs = [];
     1421        foreach ($data as $datum){
     1422            $date_time = strtotime($datum['created_at']);
     1423            $date = date_i18n('M j, Y', $date_time);
     1424
     1425            $logs[$date]['date'] = $date;
     1426            $logs[$date]['count'] = $dates_count[$date];
     1427            $logs[$date]['logs'][] = [
     1428                'time' => date_i18n('H:i', $date_time),
     1429                'user_name' => $datum['user_name'],
     1430                'status' => $datum['status'],
     1431                'title' => $datum['title'],
     1432                'event' => $datum['event'],
     1433                'description' => $datum['description'],
     1434                'ip' => $datum['ip'],
     1435                'viewed' => (int) !$datum['viewed']
     1436            ];
     1437        }
     1438        return $logs;
     1439    }
     1440
     1441    /**
     1442     * Building navigation and forming a template
     1443     *
     1444     * @param integer $limit
     1445     *  number of entries per 1 page
     1446     * @param integer $count_all
     1447     *  total number of all entries
     1448     * @param integer $currentPage
     1449     *  the number of the page being viewed
     1450     * @param integer $nextPrev
     1451     *  Show the "Forward" and "Back" buttons
     1452     * @return mixed
     1453     *  Generated navigation template ready for output
     1454     */
     1455    public static function paginationBuild($limit, $count_all, $currentPage = 1, $nextPrev = true) {
     1456        if( $limit < 1 OR $count_all <= $limit ) return '';
     1457        $count_pages = ceil( $count_all / $limit );
     1458
     1459        $spread = 3;
     1460        $separator = "<i>...</i>";
     1461        $wrap = "<div class=\"wtotem_pagination\">{pages}</div>";
     1462
     1463        $nextTitle = '←';
     1464        $prevTitle = '→';
     1465
     1466        $currentPage = intval( $currentPage );
     1467        if( $currentPage < 1 ) $currentPage = 1;
     1468
     1469        $shift_start = max( $currentPage - $spread, 2 );
     1470        $shift_end = min( $currentPage + $spread, $count_pages-1 );
     1471        if( $shift_end < $spread * 2 ) {
     1472            $shift_end = min( $spread * 2, $count_pages-1 );
     1473        }
     1474        if( $shift_end == $count_pages - 1 AND $shift_start > 3 ) {
     1475            $shift_start = max( 3, min( $count_pages - $spread * 2 + 1, $shift_start ) );
     1476        }
     1477
     1478        $list = self::getPaginationItem( 1, $currentPage );
     1479
     1480        if ($shift_start == 3) {
     1481            $list .= self::getPaginationItem( 2, $currentPage );
     1482        } elseif ( $shift_start > 3 ) {
     1483            $list .= $separator;
     1484        }
     1485
     1486        for( $i = $shift_start; $i <= $shift_end; $i++ ) {
     1487            $list .= self::getPaginationItem( $i, $currentPage );
     1488        }
     1489
     1490        $last_page = $count_pages - 1;
     1491        if( $shift_end == $last_page-1 ){
     1492            $list .= self::getPaginationItem( $last_page, $currentPage );
     1493        } elseif( $shift_end < $last_page ) {
     1494            $list .= $separator;
     1495        }
     1496
     1497        $list .= self::getPaginationItem( $count_pages, $currentPage );
     1498
     1499        if( $nextPrev ) {
     1500            $list = self::getPaginationItem(
     1501                    $currentPage > 1 ? $currentPage - 1 : 0,
     1502                    $currentPage,
     1503                    $nextTitle,
     1504                    true )
     1505                . $list
     1506                . self::getPaginationItem(
     1507                    $currentPage < $count_pages ? $currentPage + 1 : 0,
     1508                    $currentPage,
     1509                    $prevTitle,
     1510                    true
     1511                );
     1512        }
     1513
     1514        return str_replace( "{pages}", $list, $wrap );
     1515    }
     1516
     1517    /**
     1518     * Button/Link Formation
     1519     * @param int $page_num
     1520     *  page number
     1521     * @param string $currentPage
     1522     *  current page
     1523     * @param string $page_name
     1524     *  if specified, the text will be displayed instead of the page number
     1525     * @return string
     1526     *  span block with active page or link.
     1527     */
     1528    public static function getPaginationItem( $page_num, $currentPage, $page_name = '' ) {
     1529        if($page_num === 0){return '';}
     1530        $page_name = $page_name ?: $page_num;
     1531
     1532        if( $currentPage == $page_num ) {
     1533            return "<span class=\"wtotem_pagination__number wtotem_pagination__number_active\">{$page_name}</span>";
     1534        } else {
     1535            return "<a href=\"#\" data-page=\"{$page_num}\" class=\"wtotem_pagination__number\">{$page_name}</a>";
     1536        }
     1537    }
    13501538
    13511539    /**
  • wt-security/trunk/lib/Interface.php

    r2797028 r2837032  
    288288     */
    289289    public static function enqueueScripts() {
     290
    290291        // Adding CSS files.
    291292        wp_register_style(
     
    348349            true
    349350        );
     351        wp_set_script_translations( 'wtotem_flatpickr_js', 'wtotem', WEBTOTEM_PLUGIN_PATH . '/lang/');
    350352        wp_enqueue_script('wtotem_flatpickr_js');
    351         wp_set_script_translations( 'wtotem_flatpickr_js', 'wtotem' );
    352353
    353354        wp_register_script(
     
    387388        wp_enqueue_script('wtotem_toastr');
    388389
     390        $_page = WebTotemRequest::get('page');
     391        if($_page === 'wtotem_settings'){
     392            wp_register_script(
     393                'wtotem_country_blocking',
     394                WEBTOTEM_URL . '/includes/js/country-blocking.js',
     395                ['wp-i18n'],
     396                WebTotem::fileVersion('includes/js/country-blocking.js'),
     397                true
     398            );
     399            wp_set_script_translations( 'wtotem_country_blocking', 'wtotem' , WEBTOTEM_PLUGIN_PATH . '/lang/');
     400            wp_enqueue_script('wtotem_country_blocking');
     401        }
     402
    389403        wp_register_script(
    390404            'wtotem_main',
     
    396410        wp_enqueue_script('wtotem_main');
    397411    }
    398 
    399 
    400412}
  • wt-security/trunk/lib/Option.php

    r2797028 r2837032  
    636636        return $matches[1] . '=' . ($wp_version === $matches[2] ? wp_hash($matches[2]) : $matches[2]) . $matches[3];
    637637    }
     638
     639    /**
     640     * Check the nonce comming from any of the settings pages.
     641     *
     642     * @return bool True if the nonce is valid, false otherwise.
     643     */
     644    public static function checkOptionsNonce() {
     645        // Create the option_page value if permalink submission.
     646        if (!isset($_POST['option_page']) && isset($_POST['permalink_structure'])) {
     647            $_POST['option_page'] = 'permalink';
     648        }
     649
     650        /* check if the option_page has an allowed value */
     651        $option_page = WebTotemRequest::post('option_page');
     652
     653        if (!$option_page) {
     654            return false;
     655        }
     656
     657        $action = '';
     658        $nonce = '_wpnonce';
     659
     660        switch ($option_page) {
     661            case 'general':
     662            case 'writing':
     663            case 'reading':
     664            case 'discussion':
     665            case 'media':
     666            case 'options':
     667                $action = $option_page . '-options';
     668                break;
     669            case 'permalink':
     670                $action = 'update-permalink';
     671                break;
     672        }
     673
     674        /* check the nonce validity */
     675        return (bool) (
     676            !empty($action)
     677            && isset($_REQUEST[$nonce])
     678            && wp_verify_nonce($_REQUEST[$nonce], $action)
     679        );
     680    }
     681
     682    /**
     683     * Retrieve all the options stored by Wordpress in the database.
     684     *
     685     * @return array All the options stored by Wordpress in the database.
     686     */
     687    private static function getSiteOptions() {
     688        $settings = array();
     689
     690        if (array_key_exists('wpdb', $GLOBALS)) {
     691            $results = $GLOBALS['wpdb']->get_results(
     692                'SELECT * FROM ' . $GLOBALS['wpdb']->options . ' WHERE option_name NOT LIKE "%_transient_%" ORDER BY option_id ASC'
     693            );
     694
     695            foreach ($results as $row) {
     696                $settings[$row->option_name] = $row->option_value;
     697            }
     698        }
     699
     700        return $settings;
     701    }
     702
     703    /**
     704     * Check what Wordpress options were changed comparing the values in the database
     705     * with the values sent through a simple request using a GET or POST method.
     706     *
     707     * @param  array $request The content of the global variable GET or POST considering SERVER[REQUEST_METHOD].
     708     * @return array          A list of all the options that were changes through this request.
     709     */
     710    public static function whatOptionsWereChanged($request = array())
     711    {
     712        $options_changed = [ 'original' => [], 'changed' => [] ];
     713
     714        $site_options = self::getSiteOptions();
     715
     716        foreach ($request as $req_name => $req_value) {
     717            if (array_key_exists($req_name, $site_options) && $site_options[ $req_name ] != $req_value ) {
     718                $options_changed['original'][ $req_name ] = $site_options[ $req_name ];
     719                $options_changed['changed'][ $req_name ] = $req_value;
     720            }
     721        }
     722
     723        return $options_changed;
     724    }
     725
     726
    638727}
  • wt-security/trunk/readme.txt

    r2818705 r2837032  
    7171
    7272== Changelog ==
     73= 2.4.17 =
     74* Added the setting blocking countries
     75* Added WP scan page: Log of user actions. Logs on found links, scripts and iframes
     76
    7377= 2.4.16 =
    74 * Added pop-up notification 
     78* Added pop-up notification
    7579* Added 2FA to all users
    7680* Fixed an error saving settings without installed agents
  • wt-security/trunk/src/Common.php

    r2797028 r2837032  
    1919
    2020    /** Execute pre-checks before every page */
    21     add_action('init', 'WebTotemInterface::startupChecks'); //wp_loaded
     21    add_action('init', 'WebTotemInterface::startupChecks');
    2222
    2323    /** Attach HTTP request handlers for the AJAX requests */
     
    6161
    6262    /**  */
    63     add_action( 'wp', 'webtotem_add_cron' );
    64     add_action( 'webtotem_daily_cron', 'dailyCron' );
    65 
    66     function webtotem_add_cron() {
     63    add_action( 'wp', 'webtotem_add_cron_' );
     64    function webtotem_add_cron_() {
    6765        if( ! wp_next_scheduled( 'webtotem_daily_cron' ) ) {
    6866            wp_schedule_event( time(), 'daily', 'webtotem_daily_cron' );
    6967        }
    7068    }
     69
     70    add_action( 'webtotem_daily_cron', 'WtotemDailyCron' );
     71
     72    function WtotemDailyCron(){
     73        WebTotemScan::scanDB();
     74        WebTotemScan::scanFiles();
     75    }
    7176
    7277  /**
     
    8893      }
    8994      $pages['wtotem_reports']   = [ 'title' =>  __('Reports', 'wtotem'), 'slug' => $slug];
    90       $pages['wtotem_documentation'] = [ 'title' =>  __('Documentation', 'wtotem'), 'slug' => 'wtotem'];
     95      $pages['wtotem_documentation'] = [ 'title' =>  __('Documentation', 'wtotem'), 'slug' => 'wtotem'];
     96      $pages['wtotem_wpscan'] = [ 'title' =>  __('WP scan', 'wtotem'), 'slug' => 'wtotem'];
    9197
    92     return $pages;
     98      return $pages;
    9399  }
    94100
     
    142148        }
    143149        add_action('admin_menu', 'wtotemAddMenu');
    144 
    145 
    146150  }
    147151
     152    /**
     153     * Event hooks.
     154     *
     155     */
     156    if (class_exists('WebTotemEventListener')) {
     157        add_action('add_user_to_blog', 'WebTotemEventListener::hookAddUserToBlog', 50, 4);
     158        add_action('remove_user_from_blog', 'WebTotemEventListener::hookRemoveUserFromBlog', 50, 2);
     159        add_action('login_form_resetpass', 'WebTotemEventListener::hookLoginFormResetpass', 50, 5);
     160        add_action('profile_update', 'WebTotemEventListener::hookProfileUpdate', 50, 5);
     161        add_action('retrieve_password', 'WebTotemEventListener::hookRetrievePassword', 50, 5);
     162        add_action('user_register', 'WebTotemEventListener::hookUserRegister', 50, 5);
     163        add_action('deleted_user', 'WebTotemEventListener::hookUserDelete', 50, 3);
     164        add_action('wp_login', 'WebTotemEventListener::hookLoginSuccess', 50, 5);
     165        add_action('wp_login_failed', 'WebTotemEventListener::hookLoginFailure', 50, 5);
     166        add_action('add_link', 'WebTotemEventListener::hookLinkAdd', 50, 5);
     167        add_action('edit_link', 'WebTotemEventListener::hookLinkEdit', 50, 5);
     168        add_action('create_category', 'WebTotemEventListener::hookCategoryCreate', 50, 5);
     169        add_action('publish_post', 'WebTotemEventListener::hookPublishPost', 50, 5);
     170        add_action('transition_post_status', 'WebTotemEventListener::hookPostStatus', 50, 3);
     171        add_action('xmlrpc_publish_post', 'WebTotemEventListener::hookPublishPostXMLRPC', 50, 5);
     172        add_action('before_delete_post', 'WebTotemEventListener::hookPostBeforeDelete', 50, 5);
     173        add_action('delete_post', 'WebTotemEventListener::hookPostDelete', 50, 5);
     174        add_action('wp_trash_post', 'WebTotemEventListener::hookPostTrash', 50, 5);
     175        add_action('publish_page', 'WebTotemEventListener::hookPublishPage', 50, 5);
     176        add_action('add_attachment', 'WebTotemEventListener::hookAttachmentAdd', 50, 5);
     177        add_action('activated_plugin', 'WebTotemEventListener::hookPluginActivate', 50, 2);
     178        add_action('deactivated_plugin', 'WebTotemEventListener::hookPluginDeactivate', 50, 2);
     179        add_action('switch_theme', 'WebTotemEventListener::hookThemeSwitch', 50, 5);
     180
     181        add_action('admin_init', 'WebTotemEventListener::hookCoreUpdate');
     182        add_action('admin_init', 'WebTotemEventListener::hookOptionsManagement');
     183        add_action('admin_init', 'WebTotemEventListener::hookPluginDelete');
     184        add_action('admin_init', 'WebTotemEventListener::hookPluginEditor');
     185        add_action('admin_init', 'WebTotemEventListener::hookPluginInstall');
     186        add_action('admin_init', 'WebTotemEventListener::hookPluginUpdate');
     187        add_action('admin_init', 'WebTotemEventListener::hookThemeDelete');
     188        add_action('admin_init', 'WebTotemEventListener::hookThemeEditor');
     189        add_action('admin_init', 'WebTotemEventListener::hookThemeInstall');
     190        add_action('admin_init', 'WebTotemEventListener::hookThemeUpdate');
     191        add_action('admin_init', 'WebTotemEventListener::hookWidgetAdd');
     192        add_action('admin_init', 'WebTotemEventListener::hookWidgetDelete');
     193
     194    }
     195
    148196}
  • wt-security/trunk/src/PageHandler.php

    r2797028 r2837032  
    1919function wtotem_ajax_callback() {
    2020
     21    $composer_autoload = WEBTOTEM_PLUGIN_PATH . '/vendor/autoload.php';
     22    if ( file_exists( $composer_autoload ) ) {
     23        require_once $composer_autoload;
     24    }
     25
    2126    if (WebTotemRequest::post('ajax_action') != NULL) {
    2227        WebTotemAjax::authenticate();
     
    2530    if (WebTotemRequest::post('ajax_action') != NULL && WebTotemInterface::checkNonce()) {
    2631
    27         $composer_autoload = WEBTOTEM_PLUGIN_PATH . '/vendor/autoload.php';
    28         if ( file_exists( $composer_autoload ) ) {
    29             require_once $composer_autoload;
    30         }
    31 
    3232        WebTotemAjax::activation();
    3333        WebTotemAjax::agentsInstallation();
    3434        WebTotemAjax::reinstallAgents();
    35         WebTotemAjax::chart();
     35        WebTotemAjax::chart();
     36        WebTotemAjax::logs();
    3637        WebTotemAjax::wafDateFilter();
    3738        WebTotemAjax::ignorePorts();
     
    702703    }
    703704
     705    if($cacheData = WebTotemCache::getdata('getBlockedCountries', $host['id'])){
     706        $waf_data = $cacheData['data'];
     707    } else {
     708        $waf_data = WebTotemAPI::getBlockedCountries($host['id']);
     709        WebTotemCache::setData(['getBlockedCountries' => $waf_data], $host['id']);
     710    }
     711
    704712    if (empty($configs_data) or
    705713        empty($agents_statuses) or
     
    726734        ];
    727735    }
     736
    728737
    729738    // Settings form.
     
    738747            'waf_settings' => WebTotem::getWafSettingData($ip_list['settings']),
    739748            'plugin_settings' => WebTotem::getPluginSettingsData(),
    740             'two_factor' => WebTotemLogin::getTwoFactorData(),
     749            'two_factor' => WebTotemLogin::getTwoFactorData(),
     750            'blocked_countries_list' => json_encode($waf_data['blockedCountries']),
     751            'mock_attacks' => json_encode(WebTotem::getTreeMostAttacksData($waf_data['map'])),
    741752        ],
    742753
     
    747758    echo $template->baseTemplate($page_content);
    748759}
    749 
    750760
    751761/**
     
    817827    $page_content = $template->arrayRender($build);
    818828    echo $template->baseTemplate($page_content);
    819 
    820 }
     829}
     830
     831/**
     832 * Scan WP page.
     833 *
     834 * @return void
     835 */
     836function wtotem_wpscan_page() {
     837    $template = new WebTotemTemplate();
     838    $audit_logs = WebTotemDB::getRows([],'audit_logs');
     839    $links = WebTotemDB::getRows(['AND', ['data_type' => 'links']],'scan_logs', 'content');
     840    $scripts = WebTotemDB::getRows(['AND', ['data_type' => 'scripts']],'scan_logs', 'content');
     841    $iframes = WebTotemDB::getRows(['AND', ['data_type' => 'iframes']],'scan_logs', 'content');
     842
     843    $events = [
     844        'User authentication succeeded',
     845        'User authentication failed',
     846        'User account created',
     847        'User account deleted',
     848        'User account edited',
     849        'Attempt to reset password',
     850        'Password retrieval attempt',
     851        'User added to website',
     852        'User removed from website',
     853        'WordPress updated',
     854
     855        'User account deleted',
     856        'Bookmark link added',
     857        'Bookmark link edited',
     858        'Category created',
     859        'Publication was published',
     860        'Publication was updated',
     861        'Post status has been changed',
     862        'Post deleted',
     863        'Post moved to trash',
     864        'Media file added',
     865        'Plugin activated',
     866        'Plugin deactivated',
     867        'Theme activated',
     868        'Settings changed',
     869        'Plugins deleted',
     870        'Plugin editor used',
     871        'Plugin installed',
     872        'Plugins updated',
     873        'Theme deleted',
     874        'Theme editor used',
     875        'Theme installed',
     876        'Themes updated',
     877        'Widget deleted',
     878        'Widget added',
     879    ];
     880
     881    // Scan logs block.
     882    $build[] = [
     883        'variables' => [
     884            "audit_logs_count" => $audit_logs['count'],
     885            "audit_logs" => WebTotem::getAuditLogs($audit_logs['data'], $audit_logs['dates_count']),
     886            "audit_logs_pagination" => WebTotem::paginationBuild(10, $audit_logs['count']),
     887            "audit_logs_events" => WebTotemDB::checkAvailability('audit_logs', $events, 'event'),
     888
     889            "links_count" => $links['count'],
     890            "links" => $links['data'],
     891            "links_pagination" => WebTotem::paginationBuild(10, $links['count']),
     892
     893            "scripts_count" => $scripts['count'],
     894            "scripts" => $scripts['data'],
     895            "scripts_pagination" => WebTotem::paginationBuild(10, $scripts['count']),
     896
     897            "iframes_count" => $iframes['count'],
     898            "iframes" => $iframes['data'],
     899            "iframes_pagination" => WebTotem::paginationBuild(10, $iframes['count']),
     900        ],
     901        'template' => 'scan_logs',
     902    ];
     903
     904    $page_content = $template->arrayRender($build);
     905    echo $template->baseTemplate($page_content);
     906}
     907
    821908
    822909/**
  • wt-security/trunk/src/Strings.php

    r2797028 r2837032  
    279279__('Enter the code','wtotem');
    280280
     281//  country_blocking_modal.html.twig
     282__('save','wtotem');
     283__('close','wtotem');
     284__('Block countries','wtotem');
     285__('Name of the country','wtotem');
     286__('Select all countries','wtotem');
     287__('Access blocked to','wtotem');
     288__('countries','wtotem');
     289__('Country blocking','wtotem');
     290__('Block countries you want to limit access to your website.','wtotem');
     291__('Attack from','wtotem');
     292__('countries blocked from','wtotem');
     293__('Select all','wtotem');
     294
    281295// User profile
    282296__('WebTotem two-factor protection','wtotem');
     
    293307__('All stats', 'wtotem');
    294308
    295 
    296309// multisite.html.twig
    297310__('Try reinstalling the agents or changing the API key', 'wtotem');
    298311__('Data access error', 'wtotem');
     312
     313// scan_logs.html.twig
     314__('Logs', 'wtotem');
     315__('Log of user actions. And logs on found links, scripts and iframes in published posts and in files of active plugins and the current theme of the site.', 'wtotem');
     316__('Audit Logs', 'wtotem');
     317__('Links', 'wtotem');
     318__('Scripts', 'wtotem');
     319__('iFrames', 'wtotem');
     320__('Time', 'wtotem');
     321__('User', 'wtotem');
     322__('Event', 'wtotem');
     323__('All', 'wtotem');
     324__('User authentication succeeded', 'wtotem');
     325__('User authentication failed', 'wtotem');
     326__('User account created', 'wtotem');
     327__('User account deleted', 'wtotem');
     328__('User account edited', 'wtotem');
     329__('Attempt to reset password', 'wtotem');
     330__('Password retrieval attempt', 'wtotem');
     331__('User added to website', 'wtotem');
     332__('User removed from website', 'wtotem');
     333__('WordPress updated', 'wtotem');
     334__('User account deleted', 'wtotem');
     335__('Bookmark link added', 'wtotem');
     336__('Bookmark link edited', 'wtotem');
     337__('Category created', 'wtotem');
     338__('Publication was published', 'wtotem');
     339__('Publication was updated', 'wtotem');
     340__('Post status has been changed', 'wtotem');
     341__('Post deleted', 'wtotem');
     342__('Post moved to trash', 'wtotem');
     343__('Media file added', 'wtotem');
     344__('Plugin activated', 'wtotem');
     345__('Plugin deactivated', 'wtotem');
     346__('Theme activated', 'wtotem');
     347__('Settings changed', 'wtotem');
     348__('Plugins deleted', 'wtotem');
     349__('Plugin editor used', 'wtotem');
     350__('Plugin installed', 'wtotem');
     351__('Plugins updated', 'wtotem');
     352__('Theme deleted', 'wtotem');
     353__('Theme editor used', 'wtotem');
     354__('Theme installed', 'wtotem');
     355__('Themes updated', 'wtotem');
     356__('Widget deleted', 'wtotem');
     357__('Widget added', 'wtotem');
  • wt-security/trunk/wt-security.php

    r2797028 r2837032  
    77 * Text Domain: wtotem
    88 * Domain Path: /lang
    9  * Version: 2.4.16
     9 * Version: 2.4.17
    1010 *
    1111 * PHP version 7.1
     
    5454 * Current version of the plugin's code.
    5555 */
    56 define('WEBTOTEM_VERSION', '2.4.16');
     56define('WEBTOTEM_VERSION', '2.4.17');
    5757
    5858/**
     
    9393require_once 'lib/DB.php';
    9494require_once 'lib/Cache.php';
    95 require_once 'lib/login/Login.php';
     95require_once 'lib/modules/login/Login.php';
     96require_once 'lib/modules/logs/EventListener.php';
     97require_once 'lib/modules/logs/Scan.php';
    9698require_once 'lib/Request.php';
    9799require_once 'lib/Interface.php';
Note: See TracChangeset for help on using the changeset viewer.